private static String InternalGetValueAsString(Type enumType, Object value)
{
//Don't ask for the private fields. Only .value is private and we don't need that.
HashEntry hashEntry = GetHashEntry(enumType);
Type eT = GetUnderlyingType(enumType);
// Lets break this up based upon the size. We'll do part as an 64bit value
// and part as the 32bit values.
if (eT == intType || eT == typeof(short) || eT == typeof(long) || eT == typeof(ushort) || eT == typeof(byte) || eT == typeof(sbyte) || eT == typeof(uint) || eT == typeof(ulong))
{
ulong val = ToUInt64(value);
int index = BinarySearch(hashEntry.values, val);
if (index >= 0)
return hashEntry.names[index];
}
return null;
}