Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToUInt64() [4/4]

static ulong System.Enum.ToUInt64 ( object value)
inlinestaticpackage

Definition at line 240 of file Enum.cs.

241 {
242 return Convert.GetTypeCode(value) switch
243 {
244 TypeCode.SByte => (ulong)(sbyte)value,
245 TypeCode.Byte => (byte)value,
246 TypeCode.Boolean => (ulong)(((bool)value) ? 1 : 0),
247 TypeCode.Int16 => (ulong)(short)value,
248 TypeCode.UInt16 => (ushort)value,
249 TypeCode.Char => (char)value,
250 TypeCode.UInt32 => (uint)value,
251 TypeCode.Int32 => (ulong)(int)value,
252 TypeCode.UInt64 => (ulong)value,
253 TypeCode.Int64 => (ulong)(long)value,
254 _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
255 };
256 }

References System.Convert.GetTypeCode(), System.SR.InvalidOperation_UnknownEnumType, and System.value.

Referenced by System.Type.BinarySearch(), System.RuntimeType.GetEnumName(), and System.RuntimeType.IsEnumDefined().