ExtendedNumerics mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 This type is safe for multithreaded operations. System.ValueType System.IComparable System.IComparable<System.Decimal> System.IConvertible System.IEquatable<System.Decimal> System.IFormattable

Represents a floating-point decimal data type with at least 28 significant digits, suitable for financial and commercial calculations.

The type can represent values with at least 28 significant digits. The data type is ideally suited to financial calculations that require a large number of significant digits and no round-off errors.

The type shall represent values in at least the range -79228162514264337593543950335 to 79228162514264337593543950335, and having scale f such that 0 <= <= at least 28.

A value occupies 128 bits; however, its representation is unspecified (see note below).

The result of an operation on values of type is that which would result from calculating an exact result (preserving scale, as defined for each operator) and then rounding to fit the representation. That is, results are exact to at least 28 digits, but not necessarily to more than 28 decimal places. A zero result has a sign of 0.

Results are rounded to the nearest representable value, and, when a result is equally close to two representable values, to the value that has an even number in the least significant digit position (banker's rounding).

The default initial value of an instance of type is zero with a scale of zero.

Unlike the and data types, decimal fractional numbers such as 0.1 can be represented exactly in the representation. In the and representations, such numbers are often infinite fractions, making those representations prone to round-off errors.

Further, the representation preserves scale, so that 1.23 + 1.27 will give the answer 2.50, not 2.5.

If a arithmetic operation produces a value that is too small for the format after rounding, the result of the operation is zero. If a arithmetic operation produces a result that is too large for the format, a is thrown.

The class implements implicit conversions from the , , , , , , , and types to . These implicit conversions never lose information and never throw exceptions. The class also implements explicit conversions from to , , , , , , , and . These explicit conversions round the value towards zero to the nearest integer, and then convert that integer to the destination type. A is thrown if the result is not within the range of the destination type.

The class provides narrowing conversions to and from the and types. A conversion from to or can lose precision. If the value being converted is not within the range of the destination type, a is thrown. A conversion from or to throws a if the value is not within the range of the type.

Although different implementations of can have different representations, interchange of a decimal value within the range of the internal format can still be achieved by converting it to a string, exporting it, and then converting it back to internal format.

In Version 1 of this standard, the representation of was well-defined, as follows.

When considered as an array of four s, it contains the following four elements:

Index 0 (bits 0-31) contains the low-order 32 bits of the decimal's coefficient.

Index 1 (bits 32-63) contains the middle 32 bits of the decimal's coefficient.

Index 2 (bits 64-95) contains the high-order 32 bits of the decimal's coefficient.

Index 3 (bits 96-127) contains the sign bit and scale, as follows:

Bit Positions
Name Description
0-15
(None.) Zero.
16-23
Scale Contains a value between 0 and 28.
24-30
(None.) Zero.
31
Sign 0 (positive) or 1 (negative).

In order to allow alternate representations (such as in the update to the IEC floating-point standard, IEC-60559, currently in preparation), the representation has been made unspecified.

- Constructor
  The value used to initialize the new .

  Constructs and initializes a new value.

  This constructor initializes the new to the value specified by . This constructor rounds to 15 significant digits using banker's rounding. The scale of the new is the same as that produced by .

  is one of the following:

  greater than

  less than

  equal to , but the Decimal representation does not support NaNs.

  equal to , but the Decimal representation does not support infinities.

  equal to , but the Decimal representation does not support infinities.

  0
  1.0.5000.0
  2.0.0.0
- Constructor
  The value used to initialize the new .

  Constructs and initializes a new value.

  This constructor initializes the new to the value specified by . The scale of the new is 0.

  0
  1.0.5000.0
  2.0.0.0
- Constructor

  An array of four containing an unspecified 128-bit representation of a in its raw form.

  Constructs and initializes a new value.

  This constructor initializes the new to the value represented by the elements of .

  A numeric value can have several possible binary representations; they are numerically equal but have different scales. Also, the bit representation differentiates between -0, 0.00, and 0; these are all treated as 0 in operations, and any zero result will have a sign of 0.

  The format of is the same as that returned by .

  is a null reference.

  does not contain four elements.

  The following example demonstrates using the (Int32 []) constructor.

  using System; class ConstructDecimal { public static void Main() { int negativeBitValue = unchecked ((int)0x80000000); int [] parts0 = {0,0,0,0}; //Positive Zero. int [] parts1 = {1,0,0,0}; int [] parts2 = {0,1,0,0}; int [] parts3 = {0,0,1,0}; int [] parts4 = {0,0,0,negativeBitValue}; // Negative zero. int [] parts5 = {1,1,1,0}; int [] partsMaxValue = {-1,-1,-1,0}; int [] partsMinValue = {-1,-1,-1,negativeBitValue};

  decimal d = new Decimal(parts0); Console.WriteLine("{{0,0,0,0}} = {0}",d); d = new Decimal(parts1); Console.WriteLine("{{1,0,0,0}} = {0}",d); d = new Decimal(parts2); Console.WriteLine("{{0,1,0,0}} = {0}",d); d = new Decimal(parts3); Console.WriteLine("{{0,0,1,0}} = {0}",d); d = new Decimal(parts4); Console.WriteLine("{{0,0,0,{0}}} = {1}",parts4[3],d); d = new Decimal(parts5); Console.WriteLine("{{1,1,1,0}} = {0}",d); d = new Decimal(partsMaxValue ); Console.WriteLine("{{-1,-1,-1,0}} = {0}",d); d = new Decimal(partsMinValue); Console.WriteLine("{{-1,-1,-1,{0}}} = {1}",partsMinValue [3],d); } }

  The output is

  {0,0,0,0} = 0

  {1,0,0,0} = 1

  {0,1,0,0} = 4294967296

  {0,0,1,0} = 18446744073709551616

  {0,0,0,-2147483648} = 0

  {1,1,1,0} = 18446744078004518913

  {-1,-1,-1,0} = 79228162514264337593543950335

  {-1,-1,-1,-2147483648} = -79228162514264337593543950335

  0
  1.0.5000.0
  2.0.0.0
- Constructor
  The value used to initialize the new .

  Constructs and initializes a new value.

  This constructor initializes the new to the value specified by . The scale of the new is 0.

  0
  1.0.5000.0
  2.0.0.0
- Constructor
  The value used to initialize the new .

  Constructs and initializes a new value.

  This constructor initializes the new to the value specified by . This constructor rounds to 7 significant digits using banker's rounding. The scale of the new is the same as that produced by .

  is one of the following:

  greater than

  less than

  equal to , but the Decimal representation does not support NaNs.

  equal to , but the Decimal representation does not support infinities.

  equal to , but the Decimal representation does not support infinities.

  0
  1.0.5000.0
  2.0.0.0
- Constructor
  System.CLSCompliant(false)
  The value used to initialize the new .

  Constructs and initializes a new value.

  This member is not CLS-compliant. For a CLS-compliant alternative, use the () constructor.

  This constructor initializes the new to the value specified by . The scale of the new is 0.

  0
  1.0.5000.0
  2.0.0.0
- Constructor
  System.CLSCompliant(false)
  The value used to initialize the new .

  Constructs and initializes a new value.

  This constructor initializes the new to the value specified by . The scale of the new is 0.

  This member is not CLS-compliant. For a CLS-compliant alternative, use the () constructor.

  0
  1.0.5000.0
  2.0.0.0
- Constructor
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
  To be added.
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` The first addend. The second addend.

  Adds two values together.

  A containing the sum of and . The scale of the result, before any rounding, is the larger of the scales of d1 and d2. For example, 1.1 + 2.22 gives 3.32, and 2.50 + 1 gives 3.50.

  To be added. The sum of and is less than or greater than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Int32 `` `` The first value to compare. The second value to compare.

  Compares the values of two values and returns sort order information.

  The return value is a negative number, zero, or a positive number reflecting the sort order of as compared to . Trailing zero digits in the fractional part of are ignored. For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value. Each comparison compares the numerical values of and .

  Return Value
  Meaning
  Any negative number
  <
  Zero
  ==
  A positive number
  > To be added. 0 1.0.5000.0 2.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Int32 `` The to compare to the current instance.

  Returns the sort order of the current instance compared to the specified .

  The return value is a negative number, zero, or a positive number reflecting the sort order of the current instance as compared to . Trailing zero digits in the fractional part of the current instance and . For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value:

  Return Value
  Description
  A negative number
  Current instance < .
  Zero
  Current instance == .
  A positive number
  current instance > .

  This method is implemented to support the interface.

  2.0.0.0
- Method
  System.Int32 `` The to compare to the current instance.

  Returns the sort order of the current instance compared to the specified .

  The return value is a negative number, zero, or a positive number reflecting the sort order of the current instance as compared to . Trailing zero digits in the fractional part of the current instance and . For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value:

  Return Value
  Description
  A negative number
  Current instance < .
  Zero
  Current instance == .
  A positive number
  current instance > , or is a null reference.

  This method is implemented to support the interface.

  is not a and is not a null reference. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` `` The dividend. The divisor.

  Divides the value of one by another.

  A containing the result of dividing by . The scale of the result, before any rounding, is the closest scale to the preferred scale which will preserve a result equal to the exact result. The preferred scale is the scale of less the scale of . For example, 2.20 / 2 gives 1.10.

  To be added. is zero. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` The to compare to the current instance.

  Determines whether the current instance and the specified have the same value. Trailing zero digits in the fractional part are ignored.

  if is numerically equal to (has the same value as) the current instance; otherwise, .

  This method is implemented to support the interface.

  2.0.0.0
- Method
  System.Boolean `` The to compare to the current instance.

  Determines whether the current instance and the specified have the same type and value. Trailing zero digits in the fractional part are ignored.

  if has the same type and is numerically equal to (has the same value as) the current instance. If is a null reference or is not an instance of , returns .

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Boolean `` `` The first to compare. The second to compare.

  Determines whether two values have the same value. Trailing zero digits in the fractional part are ignored.

  if and are numerically equal (have the same value), otherwise .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The to round downward.

  Rounds a value to the closest integer towards negative infinity.

  A value such that is an integer and - 1 < <=

  . The scale of the result will be zero.

  To be added.

  The following example demonstrates the method.

  `using System; class DecimalTest { public static void Main() { Console.WriteLine("floor {0} is {1}", 3.14159m, Decimal.Floor(3.14159m)); Console.WriteLine("floor {0} is {1}", -3.9m, Decimal.Floor(-3.9m)); Console.WriteLine("floor {0} is {1}", 3.0m, Decimal.Floor(3.0m)); } }`

  The output is

  floor 3.14159 is 3

  floor -3.9 is -4

  floor 3.0 is 3

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int32[] `` The value for which a binary representation is returned.

  Returns a binary representation of the specified value.

  An array of four containing an unspecified 128-bit representation of a in its raw form.

  The format of the bits in the 4-element array returned is the same as that used by the parameter to .

  A numeric value can have several possible binary representations; they are numerically equal but have different scales. Also, the bit representation differentiates between -0, 0.00, and 0; these are all treated as 0 in operations, and any zero result will have a sign of 0.

  The following example demonstrates the different representations of 1.00 and 1.

  `using System; public class Class1 { public static void Print (int [] bs) { foreach (int b in bs) { Console.Write (b+" "); } } public static void Main () { decimal d = 1.00m; decimal d1 = 1; Console.Write (d); Console.Write (" - bits: "); Print (decimal.GetBits(d)); Console.WriteLine(); Console.Write (d1); Console.Write (" - bits: "); Print (decimal.GetBits(d1)); Console.WriteLine(); Console.WriteLine ("d1.CompareTo(d) == {0}", d1.CompareTo(d)); Console.WriteLine ("d1 == d {0}", d1 == d); } }` 0 1.0.5000.0 2.0.0.0
- Method
  System.Int32

  Generates a hash code for the current instance. Trailing zero digits in the fractional part are ignored.

  A containing the hash code for this instance.

  The algorithm used to generate the hash code value is unspecified.

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.TypeCode To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Field
  System.Decimal 79228162514264337593543950335

  Contains the maximum positive value for the type.

  The value of this constant is implementation-specific, but shall be greater than or equal to 79228162514264337593543950335. The scale shall be 0.

  This field is read-only.

  0
  1.0.5000.0
  2.0.0.0
- Field
  System.Decimal

  Contains negative one (-1).

  The value of this constant is -1. The scale shall be 0.

  This field is read-only.

  0
  -1
  1.0.5000.0
  2.0.0.0
- Field
  System.Decimal

  Contains the minimum (most negative) value for the type.

  The value of this constant is implementation-specific, but shall be less than or equal to -79228162514264337593543950335. The scale shall be 0.

  This field is read-only.

  0
  -79228162514264337593543950335
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` The multiplier. The multiplicand.

  Returns the result of multiplying two values.

  The result of multiplying and . The scale of the result, before any rounding, is the sum of the scales of d1 and d2.

  For example, 123 x 3 gives 369, and 2.2 x 1.35 gives 2.970.

  To be added. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The value to negate.

  Returns the result of multiplying a value by negative one.

  The negated value of . If is zero then zero is returned (with 0 sign); otherwise the scale of the result is the same as the scale of .

  To be added. 0 1.0.5000.0 2.0.0.0
- Field
  System.Decimal 1

  Contains one (1).

  The value of this constant is 1. The scale shall be 0.

  This field is read-only.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` The first addend. The second addend.

  Adds two values together.

  The value returned by (,).

  To be added. The sum of and is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` A value.

  Returns the specified value decremented by one.

  The value returned by ( , ).

  To be added. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` `` The dividend. The divisor.

  Divides one value by another .

  The value returned by (, ).

  To be added. The divisor is zero. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` `` The first to compare. The second to compare.

  Determines whether two decimals have the same value.

  if (, ) returns zero; otherwise .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Byte `` The value to convert to .

  Perform an explicit conversion of a value to .

  A with the specified value.

  This operation can produce round-off errors due to the fact that has fewer significant digits than, and has a different radix than, .

  The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Char `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  To be added. The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Double `` The value to convert to .

  Perform an explicit conversion of a value to .

  A with the specified value.

  This operation can produce round-off errors due to the fact that has fewer significant digits than .

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Int16 `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  To be added. The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Int32 `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  To be added. The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Int64 `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  To be added. The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.SByte `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  This member is not CLS-compliant. For a CLS-compliant alternative to , use .

  The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.Single `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  This member is not CLS-compliant. For a CLS-compliant alternative to , use .

  The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.UInt16 `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  This member is not CLS-compliant. For a CLS-compliant alternative to , use .

  The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.UInt32 `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  This member is not CLS-compliant. For a CLS-compliant alternative to , use ).

  The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.UInt64 `` The value to convert to .

  Perform an explicit conversion of a value to .

  A containing rounded towards zero to the nearest integer.

  This member is not CLS-compliant. For a CLS-compliant alternative to , use .

  The resulting integer value is greater than or less than . 0 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.Decimal `` The value to convert to .

  Perform an explicit conversion of a value to .

  A with the specified value.

  To be added.

  is one of the following:

  greater than

  less than

  equal to , but the Decimal representation does not support NaNs.

  equal to , but the Decimal representation does not support infinities.

  equal to , but the Decimal representation does not support infinities.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` The value to convert to .

  Perform an explicit conversion of a value to .

  A with the specified value.

  To be added.

  is one of the following:

  greater than

  less than

  equal to , but the Decimal representation does not support NaNs.

  equal to , but the Decimal representation does not support infinities.

  equal to , but the Decimal representation does not support infinities.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Boolean `` `` The first to compare. The second to compare.

  Determines whether one value is greater than another value.

  if (, ) returns a value that is greater than zero; otherwise .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` `` The first to compare. The second to compare.

  Determines whether one value is greater than or equal to another value.

  if (, ) returns a value that is greater than or equal to zero; otherwise .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  This member is not CLS-compliant.

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  This member is not CLS-compliant.

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  This member is not CLS-compliant.

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
- Method
  System.Decimal `` The value to convert to .

  Perform an implicit conversion of a value to .

  A with the specified value.

  This member is not CLS-compliant.

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
- Method
  System.Decimal `` A value.

  Returns the specified value incremented by one.

  The value returned by ( , ).

  To be added. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` `` The first to compare. The second to compare.

  Determines whether two decimals do not have the same value.

  if (, ) does not return zero; otherwise .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` `` The first to compare. The first to compare.

  Determines whether one value is less than another value.

  if (, ) returns a value that is less than zero; otherwise .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` `` The first to compare. The second to compare.

  Determines whether one value is less than or equal to another value.

  if (, ) returns a value that is less than or equal to zero; otherwise .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` `` The dividend. The divisor.

  Divides one value by another and returns the remainder.

  The value returned by (, ).

  To be added. is zero. divided by is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` `` The multiplier. The multiplicand.

  Returns the result of multiplying two values.

  The value returned by (, ).

  To be added. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` `` The minuend. The subtrahend.

  Subtracts one value from another.

  The value returned by (, ).

  To be added. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` A value.

  Returns the specified value multiplied by negative one (-1).

  The value returned by ().

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` A value.

  Returns the specified value.

  Returns .

  To be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` A containing the value to convert. The string is interpreted using the style, preserving scale.

  Returns the specified converted to a value.

  The value obtained from .

  This version of is equivalent to ( , , ).

  The string is parsed using the formatting information in a initialized for the current system culture. For more information, see .

  If necessary, the value of s is rounded using banker's rounding. Any scale apparent in the string s is preserved unless the value is rounded. If the value is zero, the sign will be 0. Hence the string "2.900" will be parsed to form the decimal with sign 0, coefficient 2900, and scale 3.

  is a null reference. is not in the correct format. represents a number greater than or less than .

  The following example demonstrates the method.

  `using System; using System.Globalization; class DecimalParseClass { public static void Main() { string s1 = " -1.001 "; string s2 = "+1,000,111.99"; string s3 = "2.900"; Console.WriteLine("String: {0} (decimal) {1}",s1,Decimal.Parse(s1)); Console.WriteLine("String: {0} (decimal) {1}",s2,Decimal.Parse(s2)); Console.WriteLine("String: {0} (decimal) {1}",s3,Decimal.Parse(s3)); } }`

  The output is

  String: -1.001 (decimal) -1.001

  String: +1,000,111.99 (decimal) 1000111.99

  String: 2.900 (decimal) 2.900

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` A containing the value to convert. The string is interpreted using the style specified by , preserving scale. Zero or more values that specify the style of . Specify multiple values for using the bitwise OR operator. If is a null reference, the string is interpreted using the style.

  Returns the specified converted to a value.

  The value obtained from .

  This version of is equivalent to (, , ).

  The string is parsed using the formatting information in a initialized for the current system culture. For more information, see .

  If necessary, the value of is rounded using banker's rounding.

  is a null reference. is not in the correct style. represents a number greater than or less than .

  The following example demonstrates supplying values to the method to allow for a symbol separating groups of digits, and a decimal separator. This example uses the symbols from the U.S. English culture, namely a comma and a decimal point.

  `using System; using System.Globalization; class DecimalParseClass { public static void Main() { string s = "1,000,111.99"; NumberStyles ns = NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint; decimal d = Decimal.Parse(s,ns); Console.WriteLine("{0} parsed to decimal {1}",s,d); } }`

  The output is

  1,000,111.99 parsed to decimal 1000111.99

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` A containing the value to convert. The is interpreted using the style, preserving scale. A that supplies a containing culture-specific formatting information about .

  Returns the specified converted to a value.

  The value obtained from .

  This version of is equivalent to (, , ).

  The string is parsed using the culture-specific formatting information from the instance supplied by . If is or a cannot be obtained from , the formatting information for the current system culture is used.

  If necessary, the value of s is rounded using banker's rounding. Any scale apparent in the string s is preserved unless the value is rounded. If the value is zero, the sign scale will be 0. Hence the string "2.900" will be parsed to form the decimal with sign 0, coefficient 2900, and scale 3.

  is not in the correct style. represents a number greater than or less than . is a null reference.

  The following example demonstrates supplying a to the method to allow a decimal point, and commas separating groups of digits.

  `using System; using System.Globalization; class DecimalParseClass { public static void Main() { string s = "1,000,111.99"; //Get the default formatting symbols. NumberFormatInfo nfi = new NumberFormatInfo(); // Default group separator is ',' // Default decimal separator is '.' decimal d = Decimal.Parse(s,nfi); Console.WriteLine("{0} parsed to decimal {1}",s,d); } }`

  The output is

  1,000,111.99 parsed to decimal 1000111.99

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` `` A containing the value to convert. The string is interpreted using the style specified by , preserving scale. Zero or more values that specify the style of . Specify multiple values for using the bitwise OR operator. If is a null reference, the string is interpreted using the style. A that supplies a containing culture-specific formatting information about .

  Returns the specified converted to a value.

  The value obtained from .

  The string is parsed using the culture-specific formatting information from the instance supplied by . If is or if a cannot be obtained from , the formatting information for the current system culture is used.

  If necessary, the value of is rounded using banker's rounding.

  is a null reference.

  is not in the correct style. represents a number greater than or less than .

  The following example demonstrates supplying values and a to the method to allow colons separating groups of digits, and a decimal point.

  `using System; using System.Globalization; class DecimalParseClass { public static void Main() { string s = "1:000:111.99"; NumberStyles ns = NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint; NumberFormatInfo nfi = new NumberFormatInfo(); //Change the format info to separate digit groups using a colon. nfi.NumberGroupSeparator = ":"; decimal d = Decimal.Parse(s,ns,nfi); Console.WriteLine("{0} parsed to decimal {1}",s,d); } }`

  The output is

  1:000:111.99 parsed to decimal 1000111.99

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` The dividend. The divisor. To be added.

  Computes the remainder after dividing two values.

  The remainder after dividing d1 by d2 to give an integer result. The sign of the result, if non-zero, is the same as the sign of d1, and the scale of the result is the larger of the scales of d1 and d2.

  For example, -10 % 3 gives -1, and 3.6 % 1.3 gives 1.0 (where % indicates the remainder operation).

  To be added. is zero. divided by is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Decimal `` `` The to round. The number of decimal places to round to. 0 <= <= 28.

  Rounds a value to a specified number of decimal places.

  The result of rounding to decimal places.

  When is exactly half way between two rounded values, the result is the rounded value that has an even digit in the rightmost decimal position. For example, when rounded to two decimals, the value 2.345 becomes 2.34 and the value 2.355 becomes 2.36. This process is known as rounding half towards even, or banker's rounding.

  The scale of the result will be the smaller of and the scale of d.

  The scale of is never increased, so cannot cause overflow.

  is not between 0 and 28, inclusive.

  The following example demonstrates the method.

  `using System; class MyClass { public static void Main() { decimal d1 = 2.5m; decimal d2 = 3.5m; decimal d3 = 2.98765432m; decimal d4 = 2.18765432m; Console.WriteLine("Rounding to 0 places..."); Console.WriteLine("round {0} = {1}",d1, Decimal.Round(d1,0)); Console.WriteLine("round {0} = {1}",d2, Decimal.Round(d2,0)); Console.WriteLine("round {0} = {1}",d3, Decimal.Round(d3,0)); Console.WriteLine("round {0} = {1}",d4, Decimal.Round(d4,0)); Console.WriteLine("Rounding to 2 places..."); Console.WriteLine("round {0} = {1}",d1, Decimal.Round(d1,2)); Console.WriteLine("round {0} = {1}",d2, Decimal.Round(d2,2)); Console.WriteLine("round {0} = {1}",d3, Decimal.Round(d3,2)); Console.WriteLine("round {0} = {1}",d4, Decimal.Round(d4,2)); } }`

  The output is

  Rounding to 0 places...

  round 2.5 = 2

  round 3.5 = 4

  round 2.98765432 = 3

  round 2.18765432 = 2

  Rounding to 2 places...

  round 2.5 = 2.5

  round 3.5 = 3.5

  round 2.98765432 = 2.99

  round 2.18765432 = 2.19

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Decimal `` `` To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Decimal `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Decimal `` `` The left-side operand. The right-side operand.

  Subtracts one value from another.

  A containing the result of subtracting from . The scale of the result, before any rounding, is the larger of the scales of d1 and d2.

  For example, 1.1 - 2.22 gives -1.12, and 2.50 - 1 gives 1.50.

  To be added. The result is greater than or less than . 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Byte `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Char `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.DateTime `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Double `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int16 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int32 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int64 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.SByte `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Single `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Object `` `` To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.UInt16 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.UInt32 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.UInt64 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Byte `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Double `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int16 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int32 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int64 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int64 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.SByte `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.Single `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.String

  Returns a canonical representation of the value of the current instance.

  A representation of the current instance formatted using the general format specifier, ("G"). The string takes into account the current system culture and preserves the scale of the number.

  This version of is equivalent to (, ).

  The general format specifier formats the number in either fixed-point or exponential notation form, preserving the scale of the number. For a detailed description of the general format, see the interface.

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.String `` A that supplies a containing culture-specific formatting information.

  Returns a representation of the value of the current instance.

  A representation of the current instance formatted using the general format specifier, ("G"). The string takes into account the formatting information in the instance supplied by .

  This version of is equivalent to ( , ).

  If is or if a cannot be obtained from , the formatting information for the current system culture is used.

  The general format specifier formats the number in either fixed-point or exponential notation form. For a detailed description of the general format, see the interface.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.String `` A that specifies the format of the returned string. For a list of valid values, see (, ).

  Returns a representation of the value of the current instance.

  A representation of the current instance formatted as specified by . The string takes into account the current system culture.

  This version of is equivalent to ( , ).

  If is a null reference, the general format specifier "G" is used.

  is invalid.

  The following example shows the effects of various formats on the string returned by .

  `using System; class test { public static void Main() { decimal d = 1234.56789m; Console.WriteLine(d); string[] fmts = {"C","E","F","G","N","P"}; for (int i=0;i<fmts.Length;i++) Console.WriteLine("{0}: {1}", fmts[i],d.ToString(fmts[i])); } }`

  The output is

  1234.56789

  C: $1,234.57

  E: 1.234568E+003

  F: 1234.57

  G: 1234.56789

  N: 1,234.57

  P: 123,456.79 %

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.String `` `` A containing a character that specifies the format of the returned string, optionally followed by a non-negative integer that specifies the precision of the number in the returned . A that supplies a instance containing culture-specific formatting information.

  Returns a representation of the value of the current instance.

  A representation of the current instance formatted as specified by . The string takes into account the information in the instance supplied by .

  If is or if a cannot be obtained from , the formatting information for the current system culture is used.

  The following table lists the characters that are valid for the parameter.

  Format Characters
  Description
  "C", "c"
  Currency format.
  "E", "e"
  Exponential notation format.
  "F", "f"
  Fixed-point format.
  "G", "g"
  General format.
  "N", "n"
  Number format.
  "P", "p"
  Percent format.

  If is a null reference, the general format specifier "G" is used.

  For a detailed description of formatting, see the interface.

  This method is implemented to support the interface.

  is invalid. 0 1.0.5000.0 2.0.0.0
- Method
  System.UInt16 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.UInt32 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.UInt64 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 System.CLSCompliant(false)
- Method
  System.Decimal `` The to truncate.

  Rounds a value towards zero, to the closest integer value.

  The result of truncating . the scale of the result is 0.

  To be added.

  The following example demonstrates using the method.

  `using System; class MyClass { public static void Main() { decimal d1 = 1234.56789m; decimal d2 = -1234.56789m; Console.WriteLine("{0} truncated is {1}", d1, Decimal.Truncate(d1)); Console.WriteLine("{0} truncated is {1}", d2, Decimal.Truncate(d2)); } }`

  The output is

  1234.56789 truncated is 1234

  -1234.56789 truncated is -1234

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Boolean `` `` To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Method
  System.Boolean `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Field
  System.Decimal 0

  Contains zero (0).

  The value of this constant is 0. The scale shall be 0.

  This field is read-only.

  0
  1.0.5000.0
  2.0.0.0
0 System.Runtime.InteropServices.ComVisible(true)