15 [__DynamicallyInvokable]
18 private const int SignMask =
int.MinValue;
20 private const byte DECIMAL_NEG = 128;
22 private const byte DECIMAL_ADD = 0;
24 private const int ScaleMask = 16711680;
26 private const int ScaleShift = 16;
28 private const int MaxInt32Scale = 9;
30 private static uint[] Powers10 =
new uint[10]
45 [__DynamicallyInvokable]
46 public const decimal
Zero = 0m;
49 [__DynamicallyInvokable]
50 public const decimal
One = 1m;
53 [__DynamicallyInvokable]
57 [__DynamicallyInvokable]
58 public const decimal
MaxValue = decimal.MaxValue;
61 [__DynamicallyInvokable]
62 public const decimal
MinValue = decimal.MinValue;
64 private const decimal NearNegativeZero = -0.000000000000000000000000001m;
66 private const decimal NearPositiveZero = 0.000000000000000000000000001m;
78 [__DynamicallyInvokable]
99 [__DynamicallyInvokable]
110 [__DynamicallyInvokable]
120 flags =
int.MinValue;
124 mid = (int)(num >> 32);
130 [CLSCompliant(
false)]
131 [__DynamicallyInvokable]
136 mid = (int)(value >> 32);
146 [SecuritySafeCritical]
147 [__DynamicallyInvokable]
148 public extern Decimal(
float value);
156 [SecuritySafeCritical]
157 [__DynamicallyInvokable]
158 public extern Decimal(
double value);
160 internal Decimal(Currency value)
162 decimal num =
Currency.ToDecimal(value);
172 [__DynamicallyInvokable]
175 return new Currency(value).ToOACurrency();
181 [__DynamicallyInvokable]
192 [__DynamicallyInvokable]
202 private void SetBits(
int[] bits)
208 if (bits.Length == 4)
211 if ((num & 0x7F00FFFF) == 0 && (num & 0xFF0000) <= 1835008)
220 throw new ArgumentException(Environment.GetResourceString(
"Arg_DecBitCtor"));
232 [__DynamicallyInvokable]
233 public Decimal(
int lo,
int mid,
int hi,
bool isNegative,
byte scale)
245 flags |=
int.MinValue;
256 catch (ArgumentException innerException)
277 private Decimal(
int lo,
int mid,
int hi,
int flags)
279 if ((flags & 0x7F00FFFF) == 0 && (flags & 0xFF0000) <= 1835008)
287 throw new ArgumentException(Environment.GetResourceString(
"Arg_DecBitCtor"));
290 internal static decimal Abs(decimal d)
292 return new decimal(d.lo, d.mid, d.hi, d.flags &
int.MaxValue);
300 [SecuritySafeCritical]
301 [__DynamicallyInvokable]
302 public static decimal
Add(decimal d1, decimal d2)
304 FCallAddSub(ref d1, ref d2, 0);
310 private static extern void FCallAddSub(ref decimal d1, ref decimal d2,
byte bSign);
314 private static extern void FCallAddSubOverflowed(ref decimal d1, ref decimal d2,
byte bSign, ref
bool overflowed);
319 [__DynamicallyInvokable]
332 [SecuritySafeCritical]
333 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
334 [__DynamicallyInvokable]
335 public static int Compare(decimal d1, decimal d2)
337 return FCallCompare(ref d1, ref d2);
342 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
343 private static extern int FCallCompare(ref decimal d1, ref decimal d2);
351 [SecuritySafeCritical]
358 if (!(value is decimal))
362 decimal d = (decimal)value;
363 return FCallCompare(ref
this, ref d);
369 [SecuritySafeCritical]
370 [__DynamicallyInvokable]
373 return FCallCompare(ref
this, ref value);
383 [SecuritySafeCritical]
384 [__DynamicallyInvokable]
385 public static decimal
Divide(decimal d1, decimal d2)
387 FCallDivide(ref d1, ref d2);
393 private static extern void FCallDivide(ref decimal d1, ref decimal d2);
397 private static extern void FCallDivideOverflowed(ref decimal d1, ref decimal d2, ref
bool overflowed);
403 [SecuritySafeCritical]
404 [__DynamicallyInvokable]
405 public override bool Equals(
object value)
407 if (value is decimal)
409 decimal d = (decimal)value;
410 return FCallCompare(ref
this, ref d) == 0;
419 [SecuritySafeCritical]
420 [__DynamicallyInvokable]
423 return FCallCompare(ref
this, ref value) == 0;
429 [SecuritySafeCritical]
430 [__DynamicallyInvokable]
438 [SecuritySafeCritical]
439 [__DynamicallyInvokable]
440 public static bool Equals(decimal d1, decimal d2)
442 return FCallCompare(ref d1, ref d2) == 0;
448 [SecuritySafeCritical]
449 [__DynamicallyInvokable]
450 public static decimal
Floor(decimal d)
458 private static extern void FCallFloor(ref decimal d);
462 [SecuritySafeCritical]
463 [__DynamicallyInvokable]
474 [SecuritySafeCritical]
475 [__DynamicallyInvokable]
484 [SecuritySafeCritical]
485 [__DynamicallyInvokable]
497 [SecuritySafeCritical]
498 [__DynamicallyInvokable]
513 [__DynamicallyInvokable]
514 public static decimal
Parse(
string s)
532 [__DynamicallyInvokable]
549 [__DynamicallyInvokable]
569 [__DynamicallyInvokable]
581 [__DynamicallyInvokable]
582 public static bool TryParse(
string s, out decimal result)
597 [__DynamicallyInvokable]
607 [__DynamicallyInvokable]
619 internal static void GetBytes(decimal d,
byte[] buffer)
621 buffer[0] = (byte)d.lo;
622 buffer[1] = (
byte)(d.lo >> 8);
623 buffer[2] = (byte)(d.lo >> 16);
624 buffer[3] = (byte)(d.lo >> 24);
625 buffer[4] = (byte)d.mid;
626 buffer[5] = (
byte)(d.mid >> 8);
627 buffer[6] = (byte)(d.mid >> 16);
628 buffer[7] = (byte)(d.mid >> 24);
629 buffer[8] = (byte)d.hi;
630 buffer[9] = (
byte)(d.hi >> 8);
631 buffer[10] = (byte)(d.hi >> 16);
632 buffer[11] = (byte)(d.hi >> 24);
633 buffer[12] = (byte)d.flags;
634 buffer[13] = (
byte)(d.flags >> 8);
635 buffer[14] = (byte)(d.flags >> 16);
636 buffer[15] = (byte)(d.flags >> 24);
639 internal static decimal ToDecimal(
byte[] buffer)
641 int num = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
642 int num2 = buffer[4] | (buffer[5] << 8) | (buffer[6] << 16) | (buffer[7] << 24);
643 int num3 = buffer[8] | (buffer[9] << 8) | (buffer[10] << 16) | (buffer[11] << 24);
644 int num4 = buffer[12] | (buffer[13] << 8) | (buffer[14] << 16) | (buffer[15] << 24);
645 return new decimal(num, num2, num3, num4);
648 private static void InternalAddUInt32RawUnchecked(ref decimal value, uint i)
650 uint num = (uint)value.lo;
651 uint num2 = (uint)(value.lo = (int)(num + i));
652 if (num2 < num || num2 < i)
654 num = (uint)value.mid;
655 num2 = (uint)(value.mid = (int)(num + 1));
656 if (num2 < num || num2 < 1)
663 private static uint InternalDivRemUInt32(ref decimal value, uint divisor)
668 ulong num2 = (uint)value.hi;
669 value.hi = (
int)(num2 / divisor);
670 num = (uint)(num2 % divisor);
672 if (value.mid != 0 || num != 0)
674 ulong num2 = ((ulong)num << 32) | (uint)value.mid;
675 value.mid = (
int)(num2 / divisor);
676 num = (uint)(num2 % divisor);
678 if (value.lo != 0 || num != 0)
680 ulong num2 = ((ulong)num << 32) | (uint)value.lo;
681 value.lo = (
int)(num2 / divisor);
682 num = (uint)(num2 % divisor);
687 private static void InternalRoundFromZero(ref decimal d,
int decimalCount)
689 int num = (d.flags & 0xFF0000) >> 16;
690 int num2 = num - decimalCount;
697 int num3 = (num2 > 9) ? 9 : num2;
698 num4 = Powers10[num3];
699 num5 = InternalDivRemUInt32(ref d, num4);
703 if (num5 >= num4 >> 1)
705 InternalAddUInt32RawUnchecked(ref d, 1u);
707 d.flags = (((decimalCount << 16) & 0xFF0000) | (d.flags &
int.MinValue));
711 [SecuritySafeCritical]
712 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
713 internal static decimal Max(decimal d1, decimal d2)
715 if (FCallCompare(ref d1, ref d2) < 0)
722 [SecuritySafeCritical]
723 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
724 internal static decimal Min(decimal d1, decimal d2)
726 if (FCallCompare(ref d1, ref d2) >= 0)
740 [__DynamicallyInvokable]
743 d2.flags = ((d2.flags &
int.MaxValue) | (d1.flags &
int.MinValue));
744 if (Abs(d1) < Abs(d2))
751 d1.flags = ((d1.flags &
int.MaxValue) | (d2.flags &
int.MinValue));
754 decimal d4 = d3 * d2;
755 decimal num = d1 - d4;
756 if ((d1.flags &
int.MinValue) != (num.flags &
int.MinValue))
758 if (-0.000000000000000000000000001m <= num && num <= 0.000000000000000000000000001m)
760 num.flags = ((num.flags &
int.MaxValue) | (d1.flags &
int.MinValue));
775 [SecuritySafeCritical]
776 [__DynamicallyInvokable]
777 public static decimal
Multiply(decimal d1, decimal d2)
779 FCallMultiply(ref d1, ref d2);
785 private static extern void FCallMultiply(ref decimal d1, ref decimal d2);
789 private static extern void FCallMultiplyOverflowed(ref decimal d1, ref decimal d2, ref
bool overflowed);
794 [__DynamicallyInvokable]
797 return new decimal(d.lo, d.mid, d.hi, d.flags ^
int.MinValue);
804 public static decimal
Round(decimal d)
815 [SecuritySafeCritical]
816 [__DynamicallyInvokable]
817 public static decimal
Round(decimal d,
int decimals)
819 FCallRound(ref d, decimals);
832 return Round(d, 0, mode);
845 [SecuritySafeCritical]
848 if (decimals < 0 || decimals > 28)
857 FCallRound(ref d, decimals);
860 InternalRoundFromZero(ref d, decimals);
868 private static extern void FCallRound(ref decimal d,
int decimals);
875 [SecuritySafeCritical]
876 [__DynamicallyInvokable]
877 public static decimal
Subtract(decimal d1, decimal d2)
879 FCallAddSub(ref d1, ref d2, 128);
888 [__DynamicallyInvokable]
900 if (num < 0 || num > 255)
912 [CLSCompliant(
false)]
913 [__DynamicallyInvokable]
925 if (num < -128 || num > 127)
937 [__DynamicallyInvokable]
949 if (num < -32768 || num > 32767)
956 [SecuritySafeCritical]
957 internal static Currency ToCurrency(decimal d)
959 Currency result =
default(Currency);
960 FCallToCurrency(ref result, d);
966 private static extern void FCallToCurrency(ref Currency result, decimal d);
972 [SecuritySafeCritical]
973 [__DynamicallyInvokable]
974 public static extern double ToDouble(decimal d);
978 internal static extern int FCallToInt32(decimal d);
985 [SecuritySafeCritical]
986 [__DynamicallyInvokable]
989 if ((d.flags & 0xFF0000) != 0)
991 FCallTruncate(ref d);
993 if (d.hi == 0 && d.mid == 0)
1020 [SecuritySafeCritical]
1021 [__DynamicallyInvokable]
1024 if ((d.flags & 0xFF0000) != 0)
1026 FCallTruncate(ref d);
1030 long num = (d.lo & uint.MaxValue) | ((
long)d.mid << 32);
1055 [CLSCompliant(
false)]
1056 [__DynamicallyInvokable]
1068 if (num < 0 || num > 65535)
1080 [SecuritySafeCritical]
1081 [CLSCompliant(
false)]
1082 [__DynamicallyInvokable]
1085 if ((d.flags & 0xFF0000) != 0)
1087 FCallTruncate(ref d);
1089 if (d.hi == 0 && d.mid == 0)
1091 uint num = (uint)d.lo;
1092 if (d.flags >= 0 || num == 0)
1105 [SecuritySafeCritical]
1106 [CLSCompliant(
false)]
1107 [__DynamicallyInvokable]
1110 if ((d.flags & 0xFF0000) != 0)
1112 FCallTruncate(ref d);
1116 ulong num = (uint)d.lo | ((ulong)(uint)d.mid << 32);
1117 if (d.flags >= 0 || num == 0
L)
1129 [SecuritySafeCritical]
1130 [__DynamicallyInvokable]
1131 public static extern float ToSingle(decimal d);
1136 [SecuritySafeCritical]
1137 [__DynamicallyInvokable]
1140 FCallTruncate(ref d);
1146 private static extern void FCallTruncate(ref decimal d);
1151 [__DynamicallyInvokable]
1152 public static implicit
operator decimal(
byte value)
1154 return new decimal(value);
1160 [CLSCompliant(
false)]
1161 [__DynamicallyInvokable]
1162 public static implicit
operator decimal(sbyte value)
1164 return new decimal(value);
1170 [__DynamicallyInvokable]
1171 public static implicit
operator decimal(
short value)
1173 return new decimal(value);
1179 [CLSCompliant(
false)]
1180 [__DynamicallyInvokable]
1181 public static implicit
operator decimal(ushort value)
1183 return new decimal(value);
1189 [__DynamicallyInvokable]
1190 public static implicit
operator decimal(
char value)
1192 return new decimal(value);
1198 [__DynamicallyInvokable]
1199 public static implicit
operator decimal(
int value)
1201 return new decimal(value);
1207 [CLSCompliant(
false)]
1208 [__DynamicallyInvokable]
1209 public static implicit
operator decimal(uint value)
1211 return new decimal(value);
1217 [__DynamicallyInvokable]
1218 public static implicit
operator decimal(
long value)
1220 return new decimal(value);
1226 [CLSCompliant(
false)]
1227 [__DynamicallyInvokable]
1228 public static implicit
operator decimal(ulong value)
1230 return new decimal(value);
1239 [__DynamicallyInvokable]
1240 public static explicit operator decimal(
float value)
1242 return new decimal(value);
1251 [__DynamicallyInvokable]
1252 public static explicit operator decimal(
double value)
1254 return new decimal(value);
1262 [__DynamicallyInvokable]
1263 public static explicit operator byte(decimal value)
1273 [CLSCompliant(
false)]
1274 [__DynamicallyInvokable]
1275 public static explicit operator sbyte(decimal value)
1285 [__DynamicallyInvokable]
1286 public static explicit operator char(decimal value)
1303 [__DynamicallyInvokable]
1304 public static explicit operator short(decimal value)
1314 [CLSCompliant(
false)]
1315 [__DynamicallyInvokable]
1316 public static explicit operator ushort(decimal value)
1326 [__DynamicallyInvokable]
1327 public static explicit operator int(decimal value)
1337 [CLSCompliant(
false)]
1338 [__DynamicallyInvokable]
1339 public static explicit operator uint(decimal value)
1349 [__DynamicallyInvokable]
1350 public static explicit operator long(decimal value)
1360 [CLSCompliant(
false)]
1361 [__DynamicallyInvokable]
1362 public static explicit operator ulong(decimal value)
1370 [__DynamicallyInvokable]
1371 public static explicit operator float(decimal value)
1379 [__DynamicallyInvokable]
1380 public static explicit operator double(decimal value)
1388 [__DynamicallyInvokable]
1397 [__DynamicallyInvokable]
1407 [__DynamicallyInvokable]
1417 [__DynamicallyInvokable]
1428 [SecuritySafeCritical]
1429 [__DynamicallyInvokable]
1432 FCallAddSub(ref d1, ref d2, 0);
1441 [SecuritySafeCritical]
1442 [__DynamicallyInvokable]
1445 FCallAddSub(ref d1, ref d2, 128);
1454 [SecuritySafeCritical]
1455 [__DynamicallyInvokable]
1458 FCallMultiply(ref d1, ref d2);
1469 [SecuritySafeCritical]
1470 [__DynamicallyInvokable]
1473 FCallDivide(ref d1, ref d2);
1484 [__DynamicallyInvokable]
1495 [SecuritySafeCritical]
1496 [__DynamicallyInvokable]
1499 return FCallCompare(ref d1, ref d2) == 0;
1507 [SecuritySafeCritical]
1508 [__DynamicallyInvokable]
1511 return FCallCompare(ref d1, ref d2) != 0;
1519 [SecuritySafeCritical]
1520 [__DynamicallyInvokable]
1523 return FCallCompare(ref d1, ref d2) < 0;
1531 [SecuritySafeCritical]
1532 [__DynamicallyInvokable]
1535 return FCallCompare(ref d1, ref d2) <= 0;
1543 [SecuritySafeCritical]
1544 [__DynamicallyInvokable]
1547 return FCallCompare(ref d1, ref d2) > 0;
1555 [SecuritySafeCritical]
1556 [__DynamicallyInvokable]
1559 return FCallCompare(ref d1, ref d2) >= 0;
1573 [__DynamicallyInvokable]
1583 [__DynamicallyInvokable]
1593 [__DynamicallyInvokable]
1603 [__DynamicallyInvokable]
1613 [__DynamicallyInvokable]
1623 [__DynamicallyInvokable]
1633 [__DynamicallyInvokable]
1643 [__DynamicallyInvokable]
1653 [__DynamicallyInvokable]
1663 [__DynamicallyInvokable]
1672 [__DynamicallyInvokable]
1681 [__DynamicallyInvokable]
1690 [__DynamicallyInvokable]
1700 [__DynamicallyInvokable]
1713 [__DynamicallyInvokable]
1716 return Convert.DefaultToType(
this, type, provider);
float ToSingle(IFormatProvider provider)
Converts the value of this instance to an equivalent single-precision floating-point number using the...
Converts a base data type to another base data type.
static decimal Floor(decimal d)
Rounds a specified T:System.Decimal number to the closest integer toward negative infinity.
override int GetHashCode()
Returns the hash code for this instance.
static long ToInt64(object value)
Converts the value of the specified object to a 64-bit signed integer.
Decimal(long value)
Initializes a new instance of T:System.Decimal to the value of the specified 64-bit signed integer.
static double ToDouble(object value)
Converts the value of the specified object to a double-precision floating-point number.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
static ushort ToUInt16(decimal value)
Converts the value of the specified T:System.Decimal to the equivalent 16-bit unsigned integer.
static long ToOACurrency(decimal value)
Converts the specified T:System.Decimal value to the equivalent OLE Automation Currency value,...
static decimal Multiply(decimal d1, decimal d2)
Multiplies two specified T:System.Decimal values.
static decimal Round(decimal d, int decimals)
Rounds a T:System.Decimal value to a specified number of decimal places.
const decimal One
Represents the number one (1).
static bool Equals(decimal d1, decimal d2)
Returns a value indicating whether two specified instances of T:System.Decimal represent the same val...
static sbyte ToSByte(decimal value)
Converts the value of the specified T:System.Decimal to the equivalent 8-bit signed integer.
static int Compare(decimal d1, decimal d2)
Compares two specified T:System.Decimal values.
static decimal Add(decimal d1, decimal d2)
Adds two specified T:System.Decimal values.
double ToDouble(IFormatProvider provider)
Converts the value of this instance to an equivalent double-precision floating-point number using the...
Decimal(uint value)
Initializes a new instance of T:System.Decimal to the value of the specified 32-bit unsigned integer.
bool ToBoolean(IFormatProvider provider)
Converts the value of this instance to an equivalent Boolean value using the specified culture-specif...
TypeCode
Specifies the type of an object.
static float ToSingle(object value)
Converts the value of the specified object to a single-precision floating-point number.
string ToString(string format, IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Indicates that a class is to be notified when deserialization of the entire object graph has been com...
static decimal Parse(string s, NumberStyles style, IFormatProvider provider)
Converts the string representation of a number to its T:System.Decimal equivalent using the specified...
The exception that is thrown when the value of an argument is outside the allowable range of values a...
The exception that is thrown for invalid casting or explicit conversion.
Represents a decimal number.
char ToChar(IFormatProvider provider)
Converts the value of this instance to an equivalent Unicode character using the specified culture-sp...
static decimal operator -(decimal d)
Negates the value of the specified T:System.Decimal operand.
override bool Equals(object value)
Returns a value indicating whether this instance and a specified T:System.Object represent the same t...
static decimal operator *(decimal d1, decimal d2)
Multiplies two specified T:System.Decimal values.
static bool operator >=(decimal d1, decimal d2)
Returns a value indicating whether a specified T:System.Decimal is greater than or equal to another s...
static decimal Round(decimal d)
Rounds a decimal value to the nearest integer.
Represents an instant in time, typically expressed as a date and time of day. To browse the ....
int CompareTo(decimal value)
Compares this instance to a specified T:System.Decimal object and returns a comparison of their relat...
string ToString(string format)
Converts the numeric value of this instance to its equivalent string representation,...
Decimal(int value)
Initializes a new instance of T:System.Decimal to the value of the specified 32-bit signed integer.
DateTime ToDateTime(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.DateTime using the specified culture-sp...
Describes the source and destination of a given serialized stream, and provides an additional caller-...
const decimal MinusOne
Represents the number negative one (-1).
sbyte ToSByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit signed integer using the specified culture...
Defines a generalized type-specific comparison method that a value type or class implements to order ...
The exception that is thrown when an arithmetic, casting, or conversion operation in a checked contex...
NumberStyles
Determines the styles permitted in numeric string arguments that are passed to the Parse and TryParse...
Cer
Specifies a method's behavior when called within a constrained execution region.
static decimal operator --(decimal d)
Decrements the T:System.Decimal operand by one.
static long ToInt64(decimal d)
Converts the value of the specified T:System.Decimal to the equivalent 64-bit signed integer.
string ToString(IFormatProvider provider)
Converts the numeric value of this instance to its equivalent string representation using the specifi...
Provides information about, and means to manipulate, the current environment and platform....
static bool ToBoolean(object value)
Converts the value of a specified object to an equivalent Boolean value.
decimal ToDecimal(IFormatProvider provider)
Converts the value of this instance to an equivalent T:System.Decimal number using the specified cult...
static uint ToUInt32(decimal d)
Converts the value of the specified T:System.Decimal to the equivalent 32-bit unsigned integer.
static decimal Subtract(decimal d1, decimal d2)
Subtracts one specified T:System.Decimal value from another.
static decimal operator++(decimal d)
Increments the T:System.Decimal operand by 1.
int ToInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit signed integer using the specified cultur...
static bool operator==(decimal d1, decimal d2)
Returns a value that indicates whether two T:System.Decimal values are equal.
static decimal operator+(decimal d)
Returns the value of the T:System.Decimal operand (the sign of the operand is unchanged).
static decimal Parse(string s, NumberStyles style)
Converts the string representation of a number in a specified style to its T:System....
const decimal MinValue
Represents the smallest possible value of T:System.Decimal. This field is constant and read-only.
void OnDeserialization(object sender)
Runs when the entire object graph has been deserialized.
static ulong ToUInt64(decimal d)
Converts the value of the specified T:System.Decimal to the equivalent 64-bit unsigned integer.
static int ToInt32(decimal d)
Converts the value of the specified T:System.Decimal to the equivalent 32-bit signed integer.
static bool operator >(decimal d1, decimal d2)
Returns a value indicating whether a specified T:System.Decimal is greater than another specified T:S...
Decimal(ulong value)
Initializes a new instance of T:System.Decimal to the value of the specified 64-bit unsigned integer.
static decimal Round(decimal d, MidpointRounding mode)
Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is ...
int CompareTo(object value)
Compares this instance to a specified object and returns a comparison of their relative values.
MidpointRounding
Specifies how mathematical rounding methods should process a number that is midway between two number...
static ushort ToUInt16(object value)
Converts the value of the specified object to a 16-bit unsigned integer.
object ToType(Type conversionType, IFormatProvider provider)
Converts the value of this instance to an T:System.Object of the specified T:System....
static sbyte ToSByte(object value)
Converts the value of the specified object to an 8-bit signed integer.
Represents type declarations: class types, interface types, array types, value types,...
The exception thrown when an error occurs during serialization or deserialization.
static decimal Divide(decimal d1, decimal d2)
Divides two specified T:System.Decimal values.
ushort ToUInt16(IFormatProvider provider)
Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified cult...
const decimal Zero
Represents the number zero (0).
MethodImplOptions
Defines the details of how a method is implemented.
static bool operator !=(decimal d1, decimal d2)
Returns a value that indicates whether two T:System.Decimal objects have different values.
static uint ToUInt32(object value)
Converts the value of the specified object to a 32-bit unsigned integer.
short ToInt16(IFormatProvider provider)
Converts the value of this instance to an equivalent 16-bit signed integer using the specified cultur...
static decimal Parse(string s)
Converts the string representation of a number to its T:System.Decimal equivalent.
static float ToSingle(decimal d)
Converts the value of the specified T:System.Decimal to the equivalent single-precision floating-poin...
long ToInt64(IFormatProvider provider)
Converts the value of this instance to an equivalent 64-bit signed integer using the specified cultur...
The exception that is thrown when one of the arguments provided to a method is not valid.
static bool TryParse(string s, out decimal result)
Converts the string representation of a number to its T:System.Decimal equivalent....
static int [] GetBits(decimal d)
Converts the value of a specified instance of T:System.Decimal to its equivalent binary representatio...
static decimal operator -(decimal d1, decimal d2)
Subtracts two specified T:System.Decimal values.
static decimal operator %(decimal d1, decimal d2)
Returns the remainder resulting from dividing two specified T:System.Decimal values.
static decimal Truncate(decimal d)
Returns the integral digits of the specified T:System.Decimal; any fractional digits are discarded.
static byte ToByte(object value)
Converts the value of the specified object to an 8-bit unsigned integer.
Defines a generalized method that a value type or class implements to create a type-specific method f...
static decimal Negate(decimal d)
Returns the result of multiplying the specified T:System.Decimal value by negative one.
static double ToDouble(decimal d)
Converts the value of the specified T:System.Decimal to the equivalent double-precision floating-poin...
static short ToInt16(object value)
Converts the value of the specified object to a 16-bit signed integer.
Specifies that the class can be serialized.
static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out decimal result)
Converts the string representation of a number to its T:System.Decimal equivalent using the specified...
static decimal FromOACurrency(long cy)
Converts the specified 64-bit signed integer, which contains an OLE Automation Currency value,...
override string ToString()
Converts the numeric value of this instance to its equivalent string representation.
Consistency
Specifies a reliability contract.
ulong ToUInt64(IFormatProvider provider)
Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified cult...
static ulong ToUInt64(object value)
Converts the value of the specified object to a 64-bit unsigned integer.
static int ToInt32(object value)
Converts the value of the specified object to a 32-bit signed integer.
TypeCode GetTypeCode()
Returns the T:System.TypeCode for value type T:System.Decimal.
Indicates that all styles except F:System.Globalization.NumberStyles.AllowExponent and F:System....
byte ToByte(IFormatProvider provider)
Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified cultu...
static short ToInt16(decimal value)
Converts the value of the specified T:System.Decimal to the equivalent 16-bit signed integer.
Decimal(int lo, int mid, int hi, bool isNegative, byte scale)
Initializes a new instance of T:System.Decimal from parameters specifying the instance's constituent ...
static decimal Remainder(decimal d1, decimal d2)
Computes the remainder after dividing two T:System.Decimal values.
Defines methods that convert the value of the implementing reference or value type to a common langua...
static byte ToByte(decimal value)
Converts the value of the specified T:System.Decimal to the equivalent 8-bit unsigned integer.
static bool operator<=(decimal d1, decimal d2)
Returns a value indicating whether a specified T:System.Decimal is less than or equal to another spec...
static decimal operator/(decimal d1, decimal d2)
Divides two specified T:System.Decimal values.
uint ToUInt32(IFormatProvider provider)
Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified cult...
static decimal Round(decimal d, int decimals, MidpointRounding mode)
Rounds a decimal value to a specified precision. A parameter specifies how to round the value if it i...
static decimal Parse(string s, IFormatProvider provider)
Converts the string representation of a number to its T:System.Decimal equivalent using the specified...
const decimal MaxValue
Represents the largest possible value of T:System.Decimal. This field is constant and read-only.
static decimal Ceiling(decimal d)
Returns the smallest integral value that is greater than or equal to the specified decimal number.
Decimal(int[] bits)
Initializes a new instance of T:System.Decimal to a decimal value represented in binary and contained...
bool Equals(decimal value)
Returns a value indicating whether this instance and a specified T:System.Decimal object represent th...
static bool operator<(decimal d1, decimal d2)
Returns a value indicating whether a specified T:System.Decimal is less than another specified T:Syst...