??????????????????????洢???????????????洢??????????á?
?????????????C#?е????????????????????????????????????????????????????????????????????????????
??????????????????????
????????????????????????System.Object?????????????????е??????????????System.Object??У?????????????????????????System.ValueType??
???????????????????System.Object??????鷽??????Щ???????????????ж???????????а???toString??????clone???????
????System.ValueType?????System.Object????System.ValueType????????????????????????????System.ValueType???????κγ????????????????е??Щ????????????????????????磬ValueType??д??Equals()?????????????????????????????????????????????????
struct Program
{
static void Main(string[] args)
{
Program testType = new Program();
if (testType.GetType().IsValueType)
{
Console.WriteLine("{0} is value type."?? testType.ToString());
}
Console.ReadLine();
}
}
?????????
???????????????
????1.C#?????????????????????System.ValueType??
???????????????????
???????壺struct???????????System.ValueType????
????????????
?????????
????short??System.Int16????ushort??System.UInt16????int??System.Int32????uint??System.UInt32????
????long??System.Int64????ulong??System.UInt64????
????sbyte(System.SByte?????????byte??System.Byte????
??????????char??System.Char????
???????????float??System.Single????double??System.Double????
???????????????????decimal???decimal??System.Decimal????
????bool???bool??System.Boolean?????????
????????enum????????System.Enum????
??????????????????System.Nullable??????壬?? T? ?? System.Nullable<T> ???д??????? T ?????????
????2.???????????????????????????????????????????????
???????磺
????int i = new int();
??????????
????Int32 i = new Int32();
??????????
????int i = 0;
??????????
????Int32 i = 0;
???????new??????????????????????????????????????????????????????У????????????0??????i??
????3.???е????????????seal???????????????????μ???????
????4.???????????????????????????????????????????Щ?????????洢????С?
????????????
??????????????????
????1.C#????????????????????????System.object??
??????????????????????
???????飺????????System.Array?????????????????????????????????????洢???й?????
??????class????????System.Object????
????????interface???????????“????”?????????????????δ???????????
??????У?delegate????????System.Delegate????
????object????System.Object?????????
???????????string??System.String?????????
????2.??????????????????μ??????
????3.??????????????null???
????4.????????????????????????????????????????????
????5.???????????????????????з????????????
???????????????????????
???????м??System.Value???????????????????????????????????
??????????????????????μ?????????????????
????????????洢????У????????????洢??????????洢????С?
??????????????????null??????????????????????????? null ????????????
?????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????е?????????????????????????????????е??????????
??????????????????????и????Ч???????????????????????洢????????壻???????????????????????????ó?????????
????Int[]??????????????????
??????????????????????????????System.Array????System.Array?????System.Object?????????е????????????????????