哈哈
其实是用xenocode反编译出来的mscorlib的C#代码.
我用这个东西反编译自己做的软件,发现准确率极高,后来用它反编译了.Net framework的核心库,可读性也是非常的强.
可不可以认为这个就是.Net framework的源代码呢?
举个例子:
String.Substring方法的代码:
public string Substring (int startIndex, int length)
{
return InternalSubStringWithChecks(startIndex, length, false);
}
internal string InternalSubStringWithChecks (int startIndex, int length, bool fAlwaysCopy)
{
int num1 = Length;
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
}
if (startIndex > num1)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_StartIndexLargerThanLength"));
}
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
}
if (startIndex > (num1 - length))
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_IndexLength"));
}
if (length == 0)
{
return string.Empty;
}
return InternalSubString(startIndex, length, fAlwaysCopy);
} private unsafe string InternalSubString (int startIndex, int length, bool fAlwaysCopy)
{
if (((startIndex == 0) && (length == Length)) && !fAlwaysCopy)
{
return this;
}
string text1 = string.FastAllocateString(length);
fixed (char* dmem = &text1.m_firstChar)
{
fixed (char* pinned2 = &m_firstChar)
{
string.wstrcpy(*dmem, * pinned2 + startIndex, length);
}
}
return text1;
}
其实是用xenocode反编译出来的mscorlib的C#代码.
我用这个东西反编译自己做的软件,发现准确率极高,后来用它反编译了.Net framework的核心库,可读性也是非常的强.
可不可以认为这个就是.Net framework的源代码呢?
举个例子:
String.Substring方法的代码:
public string Substring (int startIndex, int length)
{
return InternalSubStringWithChecks(startIndex, length, false);
}
internal string InternalSubStringWithChecks (int startIndex, int length, bool fAlwaysCopy)
{
int num1 = Length;
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
}
if (startIndex > num1)
{
throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_StartIndexLargerThanLength"));
}
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
}
if (startIndex > (num1 - length))
{
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_IndexLength"));
}
if (length == 0)
{
return string.Empty;
}
return InternalSubString(startIndex, length, fAlwaysCopy);
} private unsafe string InternalSubString (int startIndex, int length, bool fAlwaysCopy)
{
if (((startIndex == 0) && (length == Length)) && !fAlwaysCopy)
{
return this;
}
string text1 = string.FastAllocateString(length);
fixed (char* dmem = &text1.m_firstChar)
{
fixed (char* pinned2 = &m_firstChar)
{
string.wstrcpy(*dmem, * pinned2 + startIndex, length);
}
}
return text1;
}
下个community版就可以了,不要钱的
不过只能看到大部分的,有一小部分核心代码只能看到类似
public intern static ...............
然后进一步实现就看不了了