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

◆ ValueToHexString() [2/2]

static string System.Enum.ValueToHexString ( object value)
inlinestaticprivate

Definition at line 129 of file Enum.cs.

130 {
131 return Convert.GetTypeCode(value) switch
132 {
133 TypeCode.SByte => ((byte)(sbyte)value).ToString("X2", null),
134 TypeCode.Byte => ((byte)value).ToString("X2", null),
135 TypeCode.Boolean => ((bool)value) ? "01" : "00",
136 TypeCode.Int16 => ((ushort)(short)value).ToString("X4", null),
137 TypeCode.UInt16 => ((ushort)value).ToString("X4", null),
138 TypeCode.Char => ((ushort)(char)value).ToString("X4", null),
139 TypeCode.UInt32 => ((uint)value).ToString("X8", null),
140 TypeCode.Int32 => ((uint)(int)value).ToString("X8", null),
141 TypeCode.UInt64 => ((ulong)value).ToString("X16", null),
142 TypeCode.Int64 => ((ulong)(long)value).ToString("X16", null),
143 _ => throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType),
144 };
145 }
override string ToString()
Definition Enum.cs:1031

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