AT.MIN.Tools.ToUnsigned C# (CSharp) Method

ToUnsigned() public static method

Converts the specified values boxed type to its correpsonding unsigned type.
public static ToUnsigned ( object Value ) : object
Value object The value.
return object
		public static object ToUnsigned( object Value )
		{
			switch ( Type.GetTypeCode( Value.GetType() ) )
			{
				case TypeCode.SByte:
					return (byte)( (sbyte)Value );
				case TypeCode.Int16:
					return (ushort)( (short)Value );
				case TypeCode.Int32:
					return (uint)( (int)Value );
				case TypeCode.Int64:
					return (ulong)( (long)Value );

				case TypeCode.Byte:
					return Value;
				case TypeCode.UInt16:
					return Value;
				case TypeCode.UInt32:
					return Value;
				case TypeCode.UInt64:
					return Value;

				case TypeCode.Single:
					return (UInt32)( (float)Value );
				case TypeCode.Double:
					return (ulong)( (double)Value );
				case TypeCode.Decimal:
					return (ulong)( (decimal)Value );

				default:
					return null;
			}
		}
		#endregion