using System.Globalization;
using System.Runtime.InteropServices;
namespace System
{
[StructLayout(LayoutKind.Sequential),Serializable]
[CLSCompliant(false),ComVisible(true)]
public struct UInt16:System.IComparable,System.IFormattable,System.IConvertible,System.IComparable<ushort>,System.IEquatable<ushort>
{
public const ushort MaxValue = (ushort)0xFFFF;
public const ushort MinValue = (ushort)0x0000;
private ushort m_value;
public new virtual sealed int CompareTo(object @value)
{
// 代码大小 39 (0x27)
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: brtrue.s IL_0005
//IL_0003: ldc.i4.1
//IL_0004: ret
//IL_0005: ldarg.1
//IL_0006: isinst System.UInt16
//IL_000b: brfalse.s IL_0017
//IL_000d: ldarg.0
//IL_000e: ldind.u2
//IL_000f: ldarg.1
//IL_0010: unbox.any System.UInt16
//IL_0015: sub
//IL_0016: ret
//IL_0017: ldstr "Arg_MustBeUInt16"
//IL_001c: call string System.Environment::GetResourceString(string)
//IL_0021: newobj instance void System.ArgumentException::.ctor(string)
//IL_0026: throw
if (@value == null)
{
return 1;
}
else
{
if (@value as System.UInt16 == null)
{
throw new System.ArgumentException(System.Environment.GetResourceString("Arg_MustBeUInt16"));
}
else
{
return this - (System.UInt16)@value;
}
}
}
public new virtual sealed int CompareTo(ushort @value)
{
// 代码大小 5 (0x5)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldarg.1
//IL_0003: sub
//IL_0004: ret
return this-@value;
}
public virtual bool Equals(object obj)
{
// 代码大小 21 (0x15)
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: isinst System.UInt16
//IL_0006: brtrue.s IL_000a
//IL_0008: ldc.i4.0
//IL_0009: ret
//IL_000a: ldarg.0
//IL_000b: ldind.u2
//IL_000c: ldarg.1
//IL_000d: unbox.any System.UInt16
//IL_0012: ceq
//IL_0014: ret
if (obj as System.UInt16 == null)
{
return this == (System.UInt16)obj;
}
else
{
return false;
}
}
public new virtual sealed bool Equals(ushort obj)
{
// 代码大小 6 (0x6)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldarg.1
//IL_0003: ceq
//IL_0005: ret
return this == obj;
}
public virtual int GetHashCode()
{
// 代码大小 3 (0x3)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ret
return this;
}
public virtual string ToString()
{
// 代码大小 14 (0xe)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldnull
//IL_0003: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::get_CurrentInfo()
//IL_0008: call string System.Number::FormatUInt32(uint32,
// string,
// class System.Globalization.NumberFormatInfo)
//IL_000d: ret
return System.Number.FormatUInt32(this,null, NumberFormatInfo.CurrentInfo);
}
public new virtual sealed string ToString(System.IFormatProvider provider)
{
// 代码大小 15 (0xf)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldnull
//IL_0003: ldarg.1
//IL_0004: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::GetInstance(class System.IFormatProvider)
//IL_0009: call string System.Number::FormatUInt32(uint32,
// string,
// class System.Globalization.NumberFormatInfo)
//IL_000e: ret
return System.Number.FormatUInt32(this, null, NumberFormatInfo.GetInstance(provider));
}
public string ToString(string format)
{
// 代码大小 14 (0xe)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldarg.1
//IL_0003: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::get_CurrentInfo()
//IL_0008: call string System.Number::FormatUInt32(uint32,
// string,
// class System.Globalization.NumberFormatInfo)
//IL_000d: ret
return System.Number.FormatUInt32(this, format, NumberFormatInfo.CurrentInfo);
}
public new virtual sealed string ToString(string format,System.IFormatProvider provider)
{
// 代码大小 15 (0xf)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldarg.1
//IL_0003: ldarg.2
//IL_0004: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::GetInstance(class System.IFormatProvider)
//IL_0009: call string System.Number::FormatUInt32(uint32,
// string,
// class System.Globalization.NumberFormatInfo)
//IL_000e: ret
return System.Number.FormatUInt32(this, format, NumberFormatInfo.GetInstance(provider));
}
[CLSCompliant(false)]
public static ushort Parse(string s)
{
// 代码大小 13 (0xd)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4.7
//IL_0002: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::get_CurrentInfo()
//IL_0007: call uint16 System.UInt16::Parse(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo)
//IL_000c: ret
return System.UInt16.Parse(s,NumberStyles.Integer,NumberFormatInfo.CurrentInfo);
}
[CLSCompliant(false)]
public static ushort Parse(string s,System.Globalization.NumberStyles style)
{
// 代码大小 19 (0x13)
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: call void System.Globalization.NumberFormatInfo::ValidateParseStyleInteger(valuetype System.Globalization.NumberStyles)
//IL_0006: ldarg.0
//IL_0007: ldarg.1
//IL_0008: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::get_CurrentInfo()
//IL_000d: call uint16 System.UInt16::Parse(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo)
//IL_0012: ret
NumberFormatInfo.ValidateParseStyleInteger(style);
return System.UInt16.Parse(s, style, NumberFormatInfo.CurrentInfo);
}
[CLSCompliant(false)]
public static ushort Parse(string s,System.IFormatProvider provider)
{
// 代码大小 14 (0xe)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4.7
//IL_0002: ldarg.1
//IL_0003: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::GetInstance(class System.IFormatProvider)
//IL_0008: call uint16 System.UInt16::Parse(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo)
//IL_000d: ret
return System.UInt16.Parse(s, NumberStyles.Integer, NumberFormatInfo.GetInstance(provider));
}
[CLSCompliant(false)]
public static ushort Parse(string s,System.Globalization.NumberStyles style,System.IFormatProvider provider)
{
// 代码大小 20 (0x14)
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: call void System.Globalization.NumberFormatInfo::ValidateParseStyleInteger(valuetype System.Globalization.NumberStyles)
//IL_0006: ldarg.0
//IL_0007: ldarg.1
//IL_0008: ldarg.2
//IL_0009: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::GetInstance(class System.IFormatProvider)
//IL_000e: call uint16 System.UInt16::Parse(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo)
//IL_0013: ret
NumberFormatInfo.ValidateParseStyleInteger(style);
return System.UInt16.Parse(s, style, NumberFormatInfo.GetInstance(provider));
}
private static ushort Parse(string s,System.Globalization.NumberStyles style,System.Globalization.NumberFormatInfo info)
{
// 代码大小 58 (0x3a)
//.maxstack 3
//.locals init (uint32 V_0,
// class System.OverflowException V_1)
//IL_0000: ldc.i4.0
//IL_0001: stloc.0
//.try
//{
// IL_0002: ldarg.0
// IL_0003: ldarg.1
// IL_0004: ldarg.2
// IL_0005: call uint32 System.Number::ParseUInt32(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo)
// IL_000a: stloc.0
// IL_000b: leave.s IL_001f
//} // end .try
//catch System.OverflowException
//{
// IL_000d: stloc.1
// IL_000e: ldstr "Overflow_UInt16"
// IL_0013: call string System.Environment::GetResourceString(string)
// IL_0018: ldloc.1
// IL_0019: newobj instance void System.OverflowException::.ctor(string,
// class System.Exception)
// IL_001e: throw
//} // end handler
//IL_001f: ldloc.0
//IL_0020: ldc.i4 0xffff
//IL_0025: ble.un.s IL_0037
//IL_0027: ldstr "Overflow_UInt16"
//IL_002c: call string System.Environment::GetResourceString(string)
//IL_0031: newobj instance void System.OverflowException::.ctor(string)
//IL_0036: throw
//IL_0037: ldloc.0
//IL_0038: conv.u2
//IL_0039: ret
uint V_0;
V_0 = 0;
try
{
V_0=System.Number.ParseUInt32(s, style, info);
}
catch (System.OverflowException V_1)
{
throw new System.OverflowException(System.Environment.GetResourceString("Overflow_UInt16"));
}
if (V_0 <= (uint)0xffff)
{
return (ushort)V_0;
}
else
{
throw new System.OverflowException(System.Environment.GetResourceString("Overflow_UInt16"));
}
}
[CLSCompliant(false)]
public static bool TryParse(string s,out ushort result)
{
// 代码大小 14 (0xe)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4.7
//IL_0002: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::get_CurrentInfo()
//IL_0007: ldarg.1
//IL_0008: call bool System.UInt16::TryParse(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo,
// uint16&)
//IL_000d: ret
return System.UInt16.TryParse(s,NumberStyles.Integer,NumberFormatInfo.CurrentInfo, out result);
}
[CLSCompliant(false)]
public static bool TryParse(string s,System.Globalization.NumberStyles style,System.IFormatProvider provider,out ushort result)
{
// 代码大小 21 (0x15)
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: call void System.Globalization.NumberFormatInfo::ValidateParseStyleInteger(valuetype System.Globalization.NumberStyles)
//IL_0006: ldarg.0
//IL_0007: ldarg.1
//IL_0008: ldarg.2
//IL_0009: call class System.Globalization.NumberFormatInfo System.Globalization.NumberFormatInfo::GetInstance(class System.IFormatProvider)
//IL_000e: ldarg.3
//IL_000f: call bool System.UInt16::TryParse(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo,
// uint16&)
//IL_0014: ret
NumberFormatInfo.ValidateParseStyleInteger(style);
return System.UInt16.TryParse(s, style, NumberFormatInfo.GetInstance(provider), out result);
}
private static bool TryParse(string s,System.Globalization.NumberStyles style,System.Globalization.NumberFormatInfo info,out ushort result)
{
// 代码大小 33 (0x21)
//.maxstack 4
//.locals init (uint32 V_0)
//IL_0000: ldarg.3
//IL_0001: ldc.i4.0
//IL_0002: stind.i2
//IL_0003: ldarg.0
//IL_0004: ldarg.1
//IL_0005: ldarg.2
//IL_0006: ldloca.s V_0
//IL_0008: call bool System.Number::TryParseUInt32(string,
// valuetype System.Globalization.NumberStyles,
// class System.Globalization.NumberFormatInfo,
// uint32&)
//IL_000d: brtrue.s IL_0011
//IL_000f: ldc.i4.0
//IL_0010: ret
//IL_0011: ldloc.0
//IL_0012: ldc.i4 0xffff
//IL_0017: ble.un.s IL_001b
//IL_0019: ldc.i4.0
//IL_001a: ret
//IL_001b: ldarg.3
//IL_001c: ldloc.0
//IL_001d: conv.u2
//IL_001e: stind.i2
//IL_001f: ldc.i4.1
//IL_0020: ret
uint V_0;
result = 0;
if (System.Number.TryParseUInt32(s, style, info, out V_0))
{
if (V_0 <= (uint)0xffff)
{
result = (ushort)V_0;
return true;
}
}
return false;
}
public new virtual sealed System.TypeCode GetTypeCode()
{
// 代码大小 2 (0x2)
//.maxstack 8
//IL_0000: ldc.i4.8
//IL_0001: ret
return TypeCode.UInt16;
}
private new virtual sealed bool System.IConvertible.ToBoolean(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call bool System.Convert::ToBoolean(uint16)
//IL_0007: ret
return System.Convert.ToBoolean(this);
}
private new virtual sealed char System.IConvertible.ToChar(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call char System.Convert::ToChar(uint16)
//IL_0007: ret
return System.Convert.ToChar(this);
}
private new virtual sealed sbyte System.IConvertible.ToSByte(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int8 System.Convert::ToSByte(uint16)
//IL_0007: ret
return System.Convert.ToSByte(this);
}
private new virtual sealed byte System.IConvertible.ToByte(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call uint8 System.Convert::ToByte(uint16)
//IL_0007: ret
return System.Convert.ToByte(this);
}
private new virtual sealed short System.IConvertible.ToInt16(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int16 System.Convert::ToInt16(uint16)
//IL_0007: ret
return System.Convert.ToInt16(this);
}
private new virtual sealed ushort System.IConvertible.ToUInt16(System.IFormatProvider provider)
{
// 代码大小 3 (0x3)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ret
return this;
}
private new virtual sealed int System.IConvertible.ToInt32(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int32 System.Convert::ToInt32(uint16)
//IL_0007: ret
return System.Convert.ToInt32(this);
}
private new virtual sealed uint System.IConvertible.ToUInt32(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call uint32 System.Convert::ToUInt32(uint16)
//IL_0007: ret
return System.Convert.ToUInt32(this);
}
private new virtual sealed long System.IConvertible.ToInt64(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int64 System.Convert::ToInt64(uint16)
//IL_0007: ret
return System.Convert.ToInt64(this);
}
private new virtual sealed ulong System.IConvertible.ToUInt64(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call uint64 System.Convert::ToUInt64(uint16)
//IL_0007: ret
return System.Convert.ToUInt64(this);
}
private new virtual sealed float System.IConvertible.ToSingle(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call float32 System.Convert::ToSingle(uint16)
//IL_0007: ret
return System.Convert.ToSingle(this);
}
private new virtual sealed double System.IConvertible.ToDouble(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call float64 System.Convert::ToDouble(uint16)
//IL_0007: ret
return System.Convert.ToDouble(this);
}
private new virtual sealed System.Decimal System.IConvertible.ToDecimal(System.IFormatProvider provider)
{
// 代码大小 8 (0x8)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call valuetype System.Decimal System.Convert::ToDecimal(uint16)
//IL_0007: ret
return System.Convert.ToDecimal(this);
}
private new virtual sealed System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider)
{
// 代码大小 50 (0x32)
//.maxstack 5
//.locals init (object[] V_0)
//IL_0000: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0005: ldstr "InvalidCast_FromTo"
//IL_000a: call string System.Environment::GetResourceString(string)
//IL_000f: ldc.i4.2
//IL_0010: newarr System.Object
//IL_0015: stloc.0
//IL_0016: ldloc.0
//IL_0017: ldc.i4.0
//IL_0018: ldstr "UInt16"
//IL_001d: stelem.ref
//IL_001e: ldloc.0
//IL_001f: ldc.i4.1
//IL_0020: ldstr "DateTime"
//IL_0025: stelem.ref
//IL_0026: ldloc.0
//IL_0027: call string System.String::Format(class System.IFormatProvider,
// string,
// object[])
//IL_002c: newobj instance void System.InvalidCastException::.ctor(string)
//IL_0031: throw
object[] V_0;
V_0=new object[2];V_0[0]="UInt16";V_0[1]="DateTime";
throw new System.InvalidCastException(string.Format(CultureInfo.CurrentCulture, System.Environment.GetResourceString("InvalidCast_FromTo"), V_0));
}
private new virtual sealed object System.IConvertible.ToType(System.Type @type,System.IFormatProvider provider)
{
// 代码大小 15 (0xf)
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: box System.UInt16
//IL_0007: ldarg.1
//IL_0008: ldarg.2
//IL_0009: call object System.Convert::DefaultToType(class System.IConvertible,
// class System.Type,
// class System.IFormatProvider)
//IL_000e: ret
return System.Convert.DefaultToType((object)this, @type, provider);
}
}
}