提交 4ab04054 编写于 作者: C Cyrus Najmabadi

Revert

上级 ed644e0e
......@@ -25,20 +25,30 @@ internal static ulong ConvertEnumUnderlyingTypeToUInt64(object value, SpecialTyp
unchecked
{
return specialType switch
switch (specialType)
{
SpecialType.System_SByte => (ulong)(sbyte)value,
SpecialType.System_Int16 => (ulong)(short)value,
SpecialType.System_Int32 => (ulong)(int)value,
SpecialType.System_Int64 => (ulong)(long)value,
SpecialType.System_Byte => (byte)value,
SpecialType.System_UInt16 => (ushort)value,
SpecialType.System_UInt32 => (uint)value,
SpecialType.System_UInt64 => (ulong)value,
// not using ExceptionUtilities.UnexpectedValue() because this is used by the Services layer
// which doesn't have those utilities.
_ => throw new InvalidOperationException(string.Format("{0} is not a valid underlying type for an enum", specialType)),
};
case SpecialType.System_SByte:
return (ulong)(sbyte)value;
case SpecialType.System_Int16:
return (ulong)(short)value;
case SpecialType.System_Int32:
return (ulong)(int)value;
case SpecialType.System_Int64:
return (ulong)(long)value;
case SpecialType.System_Byte:
return (byte)value;
case SpecialType.System_UInt16:
return (ushort)value;
case SpecialType.System_UInt32:
return (uint)value;
case SpecialType.System_UInt64:
return (ulong)value;
default:
// not using ExceptionUtilities.UnexpectedValue() because this is used by the Services layer
// which doesn't have those utilities.
throw new InvalidOperationException(string.Format("{0} is not a valid underlying type for an enum", specialType));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册