Moh*_*deh 7 c# int32 reference-source
为什么在源代码中Int32使用?在C#中不相等?那么原始的源代码是什么?我糊涂了..intInt32intint
[Serializable]
[System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)]
[System.Runtime.InteropServices.ComVisible(true)]
#if GENERICS_WORK
public struct Int32 : IComparable, IFormattable, IConvertible
, IComparable<Int32>, IEquatable<Int32>
/// , IArithmetic<Int32>
#else
public struct Int32 : IComparable, IFormattable, IConvertible
#endif
{
internal int m_value; // Here????
public const int MaxValue = 0x7fffffff;
public const int MinValue = unchecked((int)0x80000000);
...
}
Run Code Online (Sandbox Code Playgroud)
之间存在相同的问题Boolean和bool太多.
int,bool等只是用于内建类型,如别名Int32和Boolean分别.它们是速记,因此使用它们是有意义的.甚至在他们自己的定义中.
别名内置于编译器中,因此Int32在int访问之前不必编译"鸡和鸡蛋"的情况.没有"原始源代码" int."源"用于Int32CLR内置的功能(用于处理基元)和框架(用于定义操作这些基元的功能)之间共享.正如对重复问题的答案所解释的那样,源Int32不是类型本身的有效定义; 这是内置于CLR中的.因此,编译器必须捏造该int文件中的正常非法使用,以便允许该Int32类型具有功能.