mscorlib(4.0.0.0) API with additions
System.Decimal Struct Reference

Represents a decimal number. More...

Inheritance diagram for System.Decimal:
[legend]
Collaboration diagram for System.Decimal:
[legend]

Public Member Functions

 Decimal (int value)
 Initializes a new instance of T:System.Decimal to the value of the specified 32-bit signed integer. More...
 
 Decimal (uint value)
 Initializes a new instance of T:System.Decimal to the value of the specified 32-bit unsigned integer. More...
 
 Decimal (long value)
 Initializes a new instance of T:System.Decimal to the value of the specified 64-bit signed integer. More...
 
 Decimal (ulong value)
 Initializes a new instance of T:System.Decimal to the value of the specified 64-bit unsigned integer. More...
 
 Decimal (float value)
 Initializes a new instance of T:System.Decimal to the value of the specified single-precision floating-point number. More...
 
 Decimal (double value)
 Initializes a new instance of T:System.Decimal to the value of the specified double-precision floating-point number. More...
 
internal Decimal (Currency value)
 
 Decimal (int[] bits)
 Initializes a new instance of T:System.Decimal to a decimal value represented in binary and contained in a specified array. More...
 
 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 parts. More...
 
void IDeserializationCallback. OnDeserialization (object sender)
 Runs when the deserialization of an object has been completed. More...
 
int CompareTo (object value)
 Compares this instance to a specified object and returns a comparison of their relative values. More...
 
int CompareTo (decimal value)
 Compares this instance to a specified T:System.Decimal object and returns a comparison of their relative values. More...
 
override bool Equals (object value)
 Returns a value indicating whether this instance and a specified T:System.Object represent the same type and value. More...
 
bool Equals (decimal value)
 Returns a value indicating whether this instance and a specified T:System.Decimal object represent the same value. More...
 
override int GetHashCode ()
 Returns the hash code for this instance. More...
 
override string ToString ()
 Converts the numeric value of this instance to its equivalent string representation. More...
 
string ToString (string format)
 Converts the numeric value of this instance to its equivalent string representation, using the specified format. More...
 
string ToString (IFormatProvider provider)
 Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information. More...
 
string ToString (string format, IFormatProvider provider)
 Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information. More...
 
static double ToDouble (decimal d)
 Converts the value of the specified T:System.Decimal to the equivalent double-precision floating-point number. More...
 
static internal int FCallToInt32 (decimal d)
 
static float ToSingle (decimal d)
 Converts the value of the specified T:System.Decimal to the equivalent single-precision floating-point number. More...
 
TypeCode GetTypeCode ()
 Returns the T:System.TypeCode for value type T:System.Decimal. More...
 
bool IConvertible. ToBoolean (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToBoolean(System.IFormatProvider). More...
 
char IConvertible. ToChar (IFormatProvider provider)
 This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More...
 
sbyte IConvertible. ToSByte (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToSByte(System.IFormatProvider). More...
 
byte IConvertible. ToByte (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToByte(System.IFormatProvider). More...
 
short IConvertible. ToInt16 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt16(System.IFormatProvider). More...
 
ushort IConvertible. ToUInt16 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToUInt16(System.IFormatProvider). More...
 
int IConvertible. ToInt32 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider). More...
 
uint IConvertible. ToUInt32 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider). More...
 
long IConvertible. ToInt64 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider). More...
 
ulong IConvertible. ToUInt64 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider). More...
 
float IConvertible. ToSingle (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToSingle(System.IFormatProvider). More...
 
double IConvertible. ToDouble (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToDouble(System.IFormatProvider). More...
 
decimal IConvertible. ToDecimal (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToDecimal(System.IFormatProvider). More...
 
DateTime IConvertible. ToDateTime (IFormatProvider provider)
 This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException. More...
 
object IConvertible. ToType (Type type, IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToType(System.Type,System.IFormatProvider). More...
 
- Public Member Functions inherited from System.IEquatable< decimal >
bool Equals (T other)
 Indicates whether the current object is equal to another object of the same type. More...
 

Static Public Member Functions

static long ToOACurrency (decimal value)
 Converts the specified T:System.Decimal value to the equivalent OLE Automation Currency value, which is contained in a 64-bit signed integer. More...
 
static decimal FromOACurrency (long cy)
 Converts the specified 64-bit signed integer, which contains an OLE Automation Currency value, to the equivalent T:System.Decimal value. More...
 
static internal decimal Abs (decimal d)
 
static decimal Add (decimal d1, decimal d2)
 Adds two specified T:System.Decimal values. More...
 
static decimal Ceiling (decimal d)
 Returns the smallest integral value that is greater than or equal to the specified decimal number. More...
 
static int Compare (decimal d1, decimal d2)
 Compares two specified T:System.Decimal values. More...
 
static decimal Divide (decimal d1, decimal d2)
 Divides two specified T:System.Decimal values. More...
 
static bool Equals (decimal d1, decimal d2)
 Returns a value indicating whether two specified instances of T:System.Decimal represent the same value. More...
 
static decimal Floor (decimal d)
 Rounds a specified T:System.Decimal number to the closest integer toward negative infinity. More...
 
static decimal Parse (string s)
 Converts the string representation of a number to its T:System.Decimal equivalent. More...
 
static decimal Parse (string s, NumberStyles style)
 Converts the string representation of a number in a specified style to its T:System.Decimal equivalent. More...
 
static decimal Parse (string s, IFormatProvider provider)
 Converts the string representation of a number to its T:System.Decimal equivalent using the specified culture-specific format information. More...
 
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 style and culture-specific format. More...
 
static bool TryParse (string s, out decimal result)
 Converts the string representation of a number to its T:System.Decimal equivalent. A return value indicates whether the conversion succeeded or failed. More...
 
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 style and culture-specific format. A return value indicates whether the conversion succeeded or failed. More...
 
static int [] GetBits (decimal d)
 Converts the value of a specified instance of T:System.Decimal to its equivalent binary representation. More...
 
static internal void GetBytes (decimal d, byte[] buffer)
 
static internal decimal ToDecimal (byte[] buffer)
 
static internal decimal Max (decimal d1, decimal d2)
 
static internal decimal Min (decimal d1, decimal d2)
 
static decimal Remainder (decimal d1, decimal d2)
 Computes the remainder after dividing two T:System.Decimal values. More...
 
static decimal Multiply (decimal d1, decimal d2)
 Multiplies two specified T:System.Decimal values. More...
 
static decimal Negate (decimal d)
 Returns the result of multiplying the specified T:System.Decimal value by negative one. More...
 
static decimal Round (decimal d)
 Rounds a decimal value to the nearest integer. More...
 
static decimal Round (decimal d, int decimals)
 Rounds a T:System.Decimal value to a specified number of decimal places. More...
 
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 midway between two other numbers. More...
 
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 is midway between two other numbers. More...
 
static decimal Subtract (decimal d1, decimal d2)
 Subtracts one specified T:System.Decimal value from another. More...
 
static byte ToByte (decimal value)
 Converts the value of the specified T:System.Decimal to the equivalent 8-bit unsigned integer. More...
 
static sbyte ToSByte (decimal value)
 Converts the value of the specified T:System.Decimal to the equivalent 8-bit signed integer. More...
 
static short ToInt16 (decimal value)
 Converts the value of the specified T:System.Decimal to the equivalent 16-bit signed integer. More...
 
static internal Currency ToCurrency (decimal d)
 
static int ToInt32 (decimal d)
 Converts the value of the specified T:System.Decimal to the equivalent 32-bit signed integer. More...
 
static long ToInt64 (decimal d)
 Converts the value of the specified T:System.Decimal to the equivalent 64-bit signed integer. More...
 
static ushort ToUInt16 (decimal value)
 Converts the value of the specified T:System.Decimal to the equivalent 16-bit unsigned integer. More...
 
static uint ToUInt32 (decimal d)
 Converts the value of the specified T:System.Decimal to the equivalent 32-bit unsigned integer. More...
 
static ulong ToUInt64 (decimal d)
 Converts the value of the specified T:System.Decimal to the equivalent 64-bit unsigned integer. More...
 
static decimal Truncate (decimal d)
 Returns the integral digits of the specified T:System.Decimal; any fractional digits are discarded. More...
 
static implicit operator decimal (byte value)
 Defines an implicit conversion of an 8-bit unsigned integer to a T:System.Decimal. More...
 
static implicit operator decimal (sbyte value)
 Defines an implicit conversion of an 8-bit signed integer to a T:System.Decimal. More...
 
static implicit operator decimal (short value)
 Defines an implicit conversion of a 16-bit signed integer to a T:System.Decimal. More...
 
static implicit operator decimal (ushort value)
 Defines an implicit conversion of a 16-bit unsigned integer to a T:System.Decimal. More...
 
static implicit operator decimal (char value)
 Defines an implicit conversion of a Unicode character to a T:System.Decimal. More...
 
static implicit operator decimal (int value)
 Defines an implicit conversion of a 32-bit signed integer to a T:System.Decimal. More...
 
static implicit operator decimal (uint value)
 Defines an implicit conversion of a 32-bit unsigned integer to a T:System.Decimal. More...
 
static implicit operator decimal (long value)
 Defines an implicit conversion of a 64-bit signed integer to a T:System.Decimal. More...
 
static implicit operator decimal (ulong value)
 Defines an implicit conversion of a 64-bit unsigned integer to a T:System.Decimal. More...
 
static operator decimal (float value)
 Defines an explicit conversion of a single-precision floating-point number to a T:System.Decimal. More...
 
static operator decimal (double value)
 Defines an explicit conversion of a double-precision floating-point number to a T:System.Decimal. More...
 
static operator byte (decimal value)
 Defines an explicit conversion of a T:System.Decimal to an 8-bit unsigned integer. More...
 
static operator sbyte (decimal value)
 Defines an explicit conversion of a T:System.Decimal to an 8-bit signed integer. More...
 
static operator char (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a Unicode character. More...
 
static operator short (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a 16-bit signed integer. More...
 
static operator ushort (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a 16-bit unsigned integer. More...
 
static operator int (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a 32-bit signed integer. More...
 
static operator uint (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a 32-bit unsigned integer. More...
 
static operator long (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a 64-bit signed integer. More...
 
static operator ulong (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a 64-bit unsigned integer. More...
 
static operator float (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a single-precision floating-point number. More...
 
static operator double (decimal value)
 Defines an explicit conversion of a T:System.Decimal to a double-precision floating-point number. More...
 
static decimal operator+ (decimal d)
 Returns the value of the T:System.Decimal operand (the sign of the operand is unchanged). More...
 
static decimal operator - (decimal d)
 Negates the value of the specified T:System.Decimal operand. More...
 
static decimal operator++ (decimal d)
 Increments the T:System.Decimal operand by 1. More...
 
static decimal operator -- (decimal d)
 Decrements the T:System.Decimal operand by one. More...
 
static decimal operator+ (decimal d1, decimal d2)
 Adds two specified T:System.Decimal values. More...
 
static decimal operator - (decimal d1, decimal d2)
 Subtracts two specified T:System.Decimal values. More...
 
static decimal operator * (decimal d1, decimal d2)
 Multiplies two specified T:System.Decimal values. More...
 
static decimal operator/ (decimal d1, decimal d2)
 Divides two specified T:System.Decimal values. More...
 
static decimal operator % (decimal d1, decimal d2)
 Returns the remainder resulting from dividing two specified T:System.Decimal values. More...
 
static bool operator== (decimal d1, decimal d2)
 Returns a value that indicates whether two T:System.Decimal values are equal. More...
 
static bool operator != (decimal d1, decimal d2)
 Returns a value that indicates whether two T:System.Decimal objects have different values. More...
 
static bool operator< (decimal d1, decimal d2)
 Returns a value indicating whether a specified T:System.Decimal is less than another specified T:System.Decimal. More...
 
static bool operator<= (decimal d1, decimal d2)
 Returns a value indicating whether a specified T:System.Decimal is less than or equal to another specified T:System.Decimal. More...
 
static bool operator > (decimal d1, decimal d2)
 Returns a value indicating whether a specified T:System.Decimal is greater than another specified T:System.Decimal. More...
 
static bool operator >= (decimal d1, decimal d2)
 Returns a value indicating whether a specified T:System.Decimal is greater than or equal to another specified T:System.Decimal. More...
 

Public Attributes

const decimal Zero = 0m
 Represents the number zero (0). More...
 
const decimal One = 1m
 Represents the number one (1). More...
 
const decimal MinusOne = -1m
 Represents the number negative one (-1). More...
 
const decimal MaxValue = decimal.MaxValue
 Represents the largest possible value of T:System.Decimal. This field is constant and read-only. More...
 
const decimal MinValue = decimal.MinValue
 Represents the smallest possible value of T:System.Decimal. This field is constant and read-only. More...
 

Detailed Description

Represents a decimal number.

Definition at line 16 of file Decimal.cs.

Constructor & Destructor Documentation

◆ Decimal() [1/8]

System.Decimal.Decimal ( int  value)

Initializes a new instance of T:System.Decimal to the value of the specified 32-bit signed integer.

Parameters
valueThe value to represent as a T:System.Decimal.

Definition at line 79 of file Decimal.cs.

◆ Decimal() [2/8]

System.Decimal.Decimal ( uint  value)

Initializes a new instance of T:System.Decimal to the value of the specified 32-bit unsigned integer.

Parameters
valueThe value to represent as a T:System.Decimal.

Definition at line 100 of file Decimal.cs.

◆ Decimal() [3/8]

System.Decimal.Decimal ( long  value)

Initializes a new instance of T:System.Decimal to the value of the specified 64-bit signed integer.

Parameters
valueThe value to represent as a T:System.Decimal.

Definition at line 111 of file Decimal.cs.

◆ Decimal() [4/8]

System.Decimal.Decimal ( ulong  value)

Initializes a new instance of T:System.Decimal to the value of the specified 64-bit unsigned integer.

Parameters
valueThe value to represent as a T:System.Decimal.

Definition at line 132 of file Decimal.cs.

◆ Decimal() [5/8]

System.Decimal.Decimal ( float  value)

Initializes a new instance of T:System.Decimal to the value of the specified single-precision floating-point number.

Parameters
valueThe value to represent as a T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is greater than F:System.Decimal.MaxValue or less than F:System.Decimal.MinValue.-or- value is F:System.Single.NaN, F:System.Single.PositiveInfinity, or F:System.Single.NegativeInfinity.

◆ Decimal() [6/8]

System.Decimal.Decimal ( double  value)

Initializes a new instance of T:System.Decimal to the value of the specified double-precision floating-point number.

Parameters
valueThe value to represent as a T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is greater than F:System.Decimal.MaxValue or less than F:System.Decimal.MinValue.-or- value is F:System.Double.NaN, F:System.Double.PositiveInfinity, or F:System.Double.NegativeInfinity.

◆ Decimal() [7/8]

System.Decimal.Decimal ( int []  bits)

Initializes a new instance of T:System.Decimal to a decimal value represented in binary and contained in a specified array.

Parameters
bitsAn array of 32-bit signed integers containing a representation of a decimal value.
Exceptions
T:System.ArgumentNullExceptionbits is null.
T:System.ArgumentExceptionThe length of the bits is not 4.-or- The representation of the decimal value in bits is not valid.

Definition at line 193 of file Decimal.cs.

◆ Decimal() [8/8]

System.Decimal.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 parts.

Parameters
loThe low 32 bits of a 96-bit integer.
midThe middle 32 bits of a 96-bit integer.
hiThe high 32 bits of a 96-bit integer.
isNegativetrue to indicate a negative number; false to indicate a positive number.
scaleA power of 10 ranging from 0 to 28.
Exceptions
T:System.ArgumentOutOfRangeExceptionscale is greater than 28.

Definition at line 233 of file Decimal.cs.

Member Function Documentation

◆ Add()

static decimal System.Decimal.Add ( decimal  d1,
decimal  d2 
)
static

Adds two specified T:System.Decimal values.

Parameters
d1The first value to add.
d2The second value to add.
Returns
The sum of d1 and d2 .
Exceptions
T:System.OverflowExceptionThe sum of d1 and d2 is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 302 of file Decimal.cs.

◆ Ceiling()

static decimal System.Decimal.Ceiling ( decimal  d)
static

Returns the smallest integral value that is greater than or equal to the specified decimal number.

Parameters
dA decimal number.
Returns
The smallest integral value that is greater than or equal to the d parameter. Note that this method returns a T:System.Decimal instead of an integral type.

Definition at line 320 of file Decimal.cs.

◆ Compare()

static int System.Decimal.Compare ( decimal  d1,
decimal  d2 
)
static

Compares two specified T:System.Decimal values.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
A signed number indicating the relative values of d1 and d2 .Return value Meaning Less than zero d1 is less than d2 . Zero d1 and d2 are equal. Greater than zero d1 is greater than d2 .

Definition at line 335 of file Decimal.cs.

◆ CompareTo() [1/2]

int System.Decimal.CompareTo ( object  value)

Compares this instance to a specified object and returns a comparison of their relative values.

Parameters
valueThe object to compare with this instance, or null.
Returns
A signed number indicating the relative values of this instance and value .Return value Meaning Less than zero This instance is less than value . Zero This instance is equal to value . Greater than zero This instance is greater than value .-or- value is null.
Exceptions
T:System.ArgumentExceptionvalue is not a T:System.Decimal.

Definition at line 352 of file Decimal.cs.

◆ CompareTo() [2/2]

int System.Decimal.CompareTo ( decimal  value)

Compares this instance to a specified T:System.Decimal object and returns a comparison of their relative values.

Parameters
valueThe object to compare with this instance.
Returns
A signed number indicating the relative values of this instance and value .Return value Meaning Less than zero This instance is less than value . Zero This instance is equal to value . Greater than zero This instance is greater than value .

Definition at line 371 of file Decimal.cs.

◆ Divide()

static decimal System.Decimal.Divide ( decimal  d1,
decimal  d2 
)
static

Divides two specified T:System.Decimal values.

Parameters
d1The dividend.
d2The divisor.
Returns
The result of dividing d1 by d2 .
Exceptions
T:System.DivideByZeroExceptiond2 is zero.
T:System.OverflowExceptionThe return value (that is, the quotient) is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 385 of file Decimal.cs.

◆ Equals() [1/3]

override bool System.Decimal.Equals ( object  value)

Returns a value indicating whether this instance and a specified T:System.Object represent the same type and value.

Parameters
valueThe object to compare with this instance.
Returns
true if value is a T:System.Decimal and equal to this instance; otherwise, false.

Definition at line 405 of file Decimal.cs.

◆ Equals() [2/3]

bool System.Decimal.Equals ( decimal  value)

Returns a value indicating whether this instance and a specified T:System.Decimal object represent the same value.

Parameters
valueAn object to compare to this instance.
Returns
true if value is equal to this instance; otherwise, false.

Definition at line 421 of file Decimal.cs.

◆ Equals() [3/3]

static bool System.Decimal.Equals ( decimal  d1,
decimal  d2 
)
static

Returns a value indicating whether two specified instances of T:System.Decimal represent the same value.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
true if d1 and d2 are equal; otherwise, false.

Definition at line 440 of file Decimal.cs.

◆ Floor()

static decimal System.Decimal.Floor ( decimal  d)
static

Rounds a specified T:System.Decimal number to the closest integer toward negative infinity.

Parameters
dThe value to round.
Returns
If d has a fractional part, the next whole T:System.Decimal number toward negative infinity that is less than d .-or- If d doesn't have a fractional part, d is returned unchanged. Note that the method returns an integral value of type T:System.Decimal.

Definition at line 450 of file Decimal.cs.

◆ FromOACurrency()

static decimal System.Decimal.FromOACurrency ( long  cy)
static

Converts the specified 64-bit signed integer, which contains an OLE Automation Currency value, to the equivalent T:System.Decimal value.

Parameters
cyAn OLE Automation Currency value.
Returns
A T:System.Decimal that contains the equivalent of cy .

Definition at line 182 of file Decimal.cs.

◆ GetBits()

static int [] System.Decimal.GetBits ( decimal  d)
static

Converts the value of a specified instance of T:System.Decimal to its equivalent binary representation.

Parameters
dThe value to convert.
Returns
A 32-bit signed integer array with four elements that contain the binary representation of d .

Definition at line 608 of file Decimal.cs.

◆ GetHashCode()

override int System.Decimal.GetHashCode ( )

Returns the hash code for this instance.

Returns
A 32-bit signed integer hash code.

◆ GetTypeCode()

TypeCode System.Decimal.GetTypeCode ( )

Returns the T:System.TypeCode for value type T:System.Decimal.

Returns
The enumerated constant F:System.TypeCode.Decimal.

Implements System.IConvertible.

Definition at line 1564 of file Decimal.cs.

◆ Multiply()

static decimal System.Decimal.Multiply ( decimal  d1,
decimal  d2 
)
static

Multiplies two specified T:System.Decimal values.

Parameters
d1The multiplicand.
d2The multiplier.
Returns
The result of multiplying d1 and d2 .
Exceptions
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 777 of file Decimal.cs.

◆ Negate()

static decimal System.Decimal.Negate ( decimal  d)
static

Returns the result of multiplying the specified T:System.Decimal value by negative one.

Parameters
dThe value to negate.
Returns
A decimal number with the value of d , but the opposite sign.-or- Zero, if d is zero.

Definition at line 795 of file Decimal.cs.

◆ OnDeserialization()

void IDeserializationCallback. System.Decimal.OnDeserialization ( object  sender)

Runs when the deserialization of an object has been completed.

Parameters
senderThe object that initiated the callback. The functionality for this parameter is not currently implemented.
Exceptions
T:System.Runtime.Serialization.SerializationExceptionThe T:System.Decimal object contains invalid or corrupted data.

Implements System.Runtime.Serialization.IDeserializationCallback.

Definition at line 265 of file Decimal.cs.

◆ operator !=()

static bool System.Decimal.operator != ( decimal  d1,
decimal  d2 
)
static

Returns a value that indicates whether two T:System.Decimal objects have different values.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
true if d1 and d2 are not equal; otherwise, false.

Definition at line 1509 of file Decimal.cs.

◆ operator %()

static decimal System.Decimal.operator % ( decimal  d1,
decimal  d2 
)
static

Returns the remainder resulting from dividing two specified T:System.Decimal values.

Parameters
d1The dividend.
d2The divisor.
Returns
The remainder resulting from dividing d1 by d2 .
Exceptions
T:System.DivideByZeroExceptiond2 is zero.
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 1485 of file Decimal.cs.

◆ operator *()

static decimal System.Decimal.operator * ( decimal  d1,
decimal  d2 
)
static

Multiplies two specified T:System.Decimal values.

Parameters
d1The first value to multiply.
d2The second value to multiply.
Returns
The result of multiplying d1 by d2 .
Exceptions
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 1456 of file Decimal.cs.

◆ operator -() [1/2]

static decimal System.Decimal.operator - ( decimal  d)
static

Negates the value of the specified T:System.Decimal operand.

Parameters
dThe value to negate.
Returns
The result of d multiplied by negative one (-1).

Definition at line 1398 of file Decimal.cs.

◆ operator -() [2/2]

static decimal System.Decimal.operator - ( decimal  d1,
decimal  d2 
)
static

Subtracts two specified T:System.Decimal values.

Parameters
d1The minuend.
d2The subtrahend.
Returns
The result of subtracting d2 from d1 .
Exceptions
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 1443 of file Decimal.cs.

◆ operator --()

static decimal System.Decimal.operator -- ( decimal  d)
static

Decrements the T:System.Decimal operand by one.

Parameters
dThe value to decrement.
Returns
The value of d decremented by 1.
Exceptions
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 1418 of file Decimal.cs.

◆ operator >()

static bool System.Decimal.operator > ( decimal  d1,
decimal  d2 
)
static

Returns a value indicating whether a specified T:System.Decimal is greater than another specified T:System.Decimal.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
true if d1 is greater than d2 ; otherwise, false.

Definition at line 1545 of file Decimal.cs.

◆ operator >=()

static bool System.Decimal.operator >= ( decimal  d1,
decimal  d2 
)
static

Returns a value indicating whether a specified T:System.Decimal is greater than or equal to another specified T:System.Decimal.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
true if d1 is greater than or equal to d2 ; otherwise, false.

Definition at line 1557 of file Decimal.cs.

◆ operator byte()

static System.Decimal.operator byte ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to an 8-bit unsigned integer.

Parameters
valueThe value to convert.
Returns
An 8-bit unsigned integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Byte.MinValue or greater than F:System.Byte.MaxValue.

Definition at line 1263 of file Decimal.cs.

◆ operator char()

static System.Decimal.operator char ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a Unicode character.

Parameters
valueThe value to convert.
Returns
A Unicode character that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Char.MinValue or greater than F:System.Char.MaxValue.

Definition at line 1286 of file Decimal.cs.

◆ operator decimal() [1/11]

static implicit System.Decimal.operator decimal ( byte  value)
static

Defines an implicit conversion of an 8-bit unsigned integer to a T:System.Decimal.

Parameters
valueThe 8-bit unsigned integer to convert.
Returns
The converted 8-bit unsigned integer.

Definition at line 1152 of file Decimal.cs.

◆ operator decimal() [2/11]

static implicit System.Decimal.operator decimal ( sbyte  value)
static

Defines an implicit conversion of an 8-bit signed integer to a T:System.Decimal.

Parameters
valueThe 8-bit signed integer to convert.
Returns
The converted 8-bit signed integer.

Definition at line 1162 of file Decimal.cs.

◆ operator decimal() [3/11]

static implicit System.Decimal.operator decimal ( short  value)
static

Defines an implicit conversion of a 16-bit signed integer to a T:System.Decimal.

Parameters
valueThe16-bit signed integer to convert.
Returns
The converted 16-bit signed integer.

Definition at line 1171 of file Decimal.cs.

◆ operator decimal() [4/11]

static implicit System.Decimal.operator decimal ( ushort  value)
static

Defines an implicit conversion of a 16-bit unsigned integer to a T:System.Decimal.

Parameters
valueThe 16-bit unsigned integer to convert.
Returns
The converted 16-bit unsigned integer.

Definition at line 1181 of file Decimal.cs.

◆ operator decimal() [5/11]

static implicit System.Decimal.operator decimal ( char  value)
static

Defines an implicit conversion of a Unicode character to a T:System.Decimal.

Parameters
valueThe Unicode character to convert.
Returns
The converted Unicode character.

Definition at line 1190 of file Decimal.cs.

◆ operator decimal() [6/11]

static implicit System.Decimal.operator decimal ( int  value)
static

Defines an implicit conversion of a 32-bit signed integer to a T:System.Decimal.

Parameters
valueThe 32-bit signed integer to convert.
Returns
The converted 32-bit signed integer.

Definition at line 1199 of file Decimal.cs.

◆ operator decimal() [7/11]

static implicit System.Decimal.operator decimal ( uint  value)
static

Defines an implicit conversion of a 32-bit unsigned integer to a T:System.Decimal.

Parameters
valueThe 32-bit unsigned integer to convert.
Returns
The converted 32-bit unsigned integer.

Definition at line 1209 of file Decimal.cs.

◆ operator decimal() [8/11]

static implicit System.Decimal.operator decimal ( long  value)
static

Defines an implicit conversion of a 64-bit signed integer to a T:System.Decimal.

Parameters
valueThe 64-bit signed integer to convert.
Returns
The converted 64-bit signed integer.

Definition at line 1218 of file Decimal.cs.

◆ operator decimal() [9/11]

static implicit System.Decimal.operator decimal ( ulong  value)
static

Defines an implicit conversion of a 64-bit unsigned integer to a T:System.Decimal.

Parameters
valueThe 64-bit unsigned integer to convert.
Returns
The converted 64-bit unsigned integer.

Definition at line 1228 of file Decimal.cs.

◆ operator decimal() [10/11]

static System.Decimal.operator decimal ( float  value)
explicitstatic

Defines an explicit conversion of a single-precision floating-point number to a T:System.Decimal.

Parameters
valueThe single-precision floating-point number to convert.
Returns
The converted single-precision floating point number.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.-or- value is F:System.Single.NaN, F:System.Single.PositiveInfinity, or F:System.Single.NegativeInfinity.

Definition at line 1240 of file Decimal.cs.

◆ operator decimal() [11/11]

static System.Decimal.operator decimal ( double  value)
explicitstatic

Defines an explicit conversion of a double-precision floating-point number to a T:System.Decimal.

Parameters
valueThe double-precision floating-point number to convert.
Returns
The converted double-precision floating point number.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.-or- value is F:System.Double.NaN, F:System.Double.PositiveInfinity, or F:System.Double.NegativeInfinity.

Definition at line 1252 of file Decimal.cs.

◆ operator double()

static System.Decimal.operator double ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a double-precision floating-point number.

Parameters
valueThe value to convert.
Returns
A double-precision floating-point number that represents the converted T:System.Decimal.

Definition at line 1380 of file Decimal.cs.

◆ operator float()

static System.Decimal.operator float ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a single-precision floating-point number.

Parameters
valueThe value to convert.
Returns
A single-precision floating-point number that represents the converted T:System.Decimal.

Definition at line 1371 of file Decimal.cs.

◆ operator int()

static System.Decimal.operator int ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a 32-bit signed integer.

Parameters
valueThe value to convert.
Returns
A 32-bit signed integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Int32.MinValue or greater than F:System.Int32.MaxValue.

Definition at line 1327 of file Decimal.cs.

◆ operator long()

static System.Decimal.operator long ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a 64-bit signed integer.

Parameters
valueThe value to convert.
Returns
A 64-bit signed integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Int64.MinValue or greater than F:System.Int64.MaxValue.

Definition at line 1350 of file Decimal.cs.

◆ operator sbyte()

static System.Decimal.operator sbyte ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to an 8-bit signed integer.

Parameters
valueThe value to convert.
Returns
An 8-bit signed integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue.

Definition at line 1275 of file Decimal.cs.

◆ operator short()

static System.Decimal.operator short ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a 16-bit signed integer.

Parameters
valueThe value to convert.
Returns
A 16-bit signed integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Int16.MinValue or greater than F:System.Int16.MaxValue.

Definition at line 1304 of file Decimal.cs.

◆ operator uint()

static System.Decimal.operator uint ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a 32-bit unsigned integer.

Parameters
valueThe value to convert.
Returns
A 32-bit unsigned integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is negative or greater than F:System.UInt32.MaxValue.

Definition at line 1339 of file Decimal.cs.

◆ operator ulong()

static System.Decimal.operator ulong ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a 64-bit unsigned integer.

Parameters
valueThe value to convert.
Returns
A 64-bit unsigned integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is negative or greater than F:System.UInt64.MaxValue.

Definition at line 1362 of file Decimal.cs.

◆ operator ushort()

static System.Decimal.operator ushort ( decimal  value)
explicitstatic

Defines an explicit conversion of a T:System.Decimal to a 16-bit unsigned integer.

Parameters
valueThe value to convert.
Returns
A 16-bit unsigned integer that represents the converted T:System.Decimal.
Exceptions
T:System.OverflowExceptionvalue is greater than F:System.UInt16.MaxValue or less than F:System.UInt16.MinValue.

Definition at line 1316 of file Decimal.cs.

◆ operator+() [1/2]

static decimal System.Decimal.operator+ ( decimal  d)
static

Returns the value of the T:System.Decimal operand (the sign of the operand is unchanged).

Parameters
dThe operand to return.
Returns
The value of the operand, d .

Definition at line 1389 of file Decimal.cs.

◆ operator+() [2/2]

static decimal System.Decimal.operator+ ( decimal  d1,
decimal  d2 
)
static

Adds two specified T:System.Decimal values.

Parameters
d1The first value to add.
d2The second value to add.
Returns
The result of adding d1 and d2 .
Exceptions
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 1430 of file Decimal.cs.

◆ operator++()

static decimal System.Decimal.operator++ ( decimal  d)
static

Increments the T:System.Decimal operand by 1.

Parameters
dThe value to increment.
Returns
The value of d incremented by 1.
Exceptions
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 1408 of file Decimal.cs.

◆ operator/()

static decimal System.Decimal.operator/ ( decimal  d1,
decimal  d2 
)
static

Divides two specified T:System.Decimal values.

Parameters
d1The dividend.
d2The divisor.
Returns
The result of dividing d1 by d2 .
Exceptions
T:System.DivideByZeroExceptiond2 is zero.
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 1471 of file Decimal.cs.

◆ operator<()

static bool System.Decimal.operator< ( decimal  d1,
decimal  d2 
)
static

Returns a value indicating whether a specified T:System.Decimal is less than another specified T:System.Decimal.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
true if d1 is less than d2 ; otherwise, false.

Definition at line 1521 of file Decimal.cs.

◆ operator<=()

static bool System.Decimal.operator<= ( decimal  d1,
decimal  d2 
)
static

Returns a value indicating whether a specified T:System.Decimal is less than or equal to another specified T:System.Decimal.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
true if d1 is less than or equal to d2 ; otherwise, false.

Definition at line 1533 of file Decimal.cs.

◆ operator==()

static bool System.Decimal.operator== ( decimal  d1,
decimal  d2 
)
static

Returns a value that indicates whether two T:System.Decimal values are equal.

Parameters
d1The first value to compare.
d2The second value to compare.
Returns
true if d1 and d2 are equal; otherwise, false.

Definition at line 1497 of file Decimal.cs.

◆ Parse() [1/4]

static decimal System.Decimal.Parse ( string  s)
static

Converts the string representation of a number to its T:System.Decimal equivalent.

Parameters
sThe string representation of the number to convert.
Returns
The equivalent to the number contained in s .
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.FormatExceptions is not in the correct format.
T:System.OverflowExceptions represents a number less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 514 of file Decimal.cs.

◆ Parse() [2/4]

static decimal System.Decimal.Parse ( string  s,
NumberStyles  style 
)
static

Converts the string representation of a number in a specified style to its T:System.Decimal equivalent.

Parameters
sThe string representation of the number to convert.
styleA bitwise combination of T:System.Globalization.NumberStyles values that indicates the style elements that can be present in s . A typical value to specify is F:System.Globalization.NumberStyles.Number.
Returns
The T:System.Decimal number equivalent to the number contained in s as specified by style .
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentExceptionstyle is not a T:System.Globalization.NumberStyles value. -or- style is the F:System.Globalization.NumberStyles.AllowHexSpecifier value.
T:System.FormatExceptions is not in the correct format.
T:System.OverflowExceptions represents a number less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue

Definition at line 533 of file Decimal.cs.

◆ Parse() [3/4]

static decimal System.Decimal.Parse ( string  s,
IFormatProvider  provider 
)
static

Converts the string representation of a number to its T:System.Decimal equivalent using the specified culture-specific format information.

Parameters
sThe string representation of the number to convert.
providerAn T:System.IFormatProvider that supplies culture-specific parsing information about s .
Returns
The T:System.Decimal number equivalent to the number contained in s as specified by provider .
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.FormatExceptions is not of the correct format
T:System.OverflowExceptions represents a number less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue

Definition at line 550 of file Decimal.cs.

◆ Parse() [4/4]

static decimal System.Decimal.Parse ( string  s,
NumberStyles  style,
IFormatProvider  provider 
)
static

Converts the string representation of a number to its T:System.Decimal equivalent using the specified style and culture-specific format.

Parameters
sThe string representation of the number to convert.
styleA bitwise combination of T:System.Globalization.NumberStyles values that indicates the style elements that can be present in s . A typical value to specify is F:System.Globalization.NumberStyles.Number.
providerAn T:System.IFormatProvider object that supplies culture-specific information about the format of s .
Returns
The T:System.Decimal number equivalent to the number contained in s as specified by style and provider .
Exceptions
T:System.FormatExceptions is not in the correct format.
T:System.OverflowExceptions represents a number less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.
T:System.ArgumentNullExceptions is null.
T:System.ArgumentExceptionstyle is not a T:System.Globalization.NumberStyles value. -or- style is the F:System.Globalization.NumberStyles.AllowHexSpecifier value.

Definition at line 570 of file Decimal.cs.

◆ Remainder()

static decimal System.Decimal.Remainder ( decimal  d1,
decimal  d2 
)
static

Computes the remainder after dividing two T:System.Decimal values.

Parameters
d1The dividend.
d2The divisor.
Returns
The remainder after dividing d1 by d2 .
Exceptions
T:System.DivideByZeroExceptiond2 is zero.
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 741 of file Decimal.cs.

◆ Round() [1/4]

static decimal System.Decimal.Round ( decimal  d)
static

Rounds a decimal value to the nearest integer.

Parameters
dA decimal number to round.
Returns
The integer that is nearest to the d parameter. If d is halfway between two integers, one of which is even and the other odd, the even number is returned.
Exceptions
T:System.OverflowExceptionThe result is outside the range of a T:System.Decimal value.

Definition at line 804 of file Decimal.cs.

◆ Round() [2/4]

static decimal System.Decimal.Round ( decimal  d,
int  decimals 
)
static

Rounds a T:System.Decimal value to a specified number of decimal places.

Parameters
dA decimal number to round.
decimalsA value from 0 to 28 that specifies the number of decimal places to round to.
Returns
The decimal number equivalent to d rounded to decimals number of decimal places.
Exceptions
T:System.ArgumentOutOfRangeExceptiondecimals is not a value from 0 to 28.

Definition at line 817 of file Decimal.cs.

◆ Round() [3/4]

static decimal System.Decimal.Round ( decimal  d,
MidpointRounding  mode 
)
static

Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.

Parameters
dA decimal number to round.
modeA value that specifies how to round d if it is midway between two other numbers.
Returns
The integer that is nearest to the d parameter. If d is halfway between two numbers, one of which is even and the other odd, the mode parameter determines which of the two numbers is returned.
Exceptions
T:System.ArgumentExceptionmode is not a T:System.MidpointRounding value.
T:System.OverflowExceptionThe result is outside the range of a T:System.Decimal object.

Definition at line 830 of file Decimal.cs.

◆ Round() [4/4]

static decimal System.Decimal.Round ( decimal  d,
int  decimals,
MidpointRounding  mode 
)
static

Rounds a decimal value to a specified precision. A parameter specifies how to round the value if it is midway between two other numbers.

Parameters
dA decimal number to round.
decimalsThe number of significant decimal places (precision) in the return value.
modeA value that specifies how to round d if it is midway between two other numbers.
Returns
The number that is nearest to the d parameter with a precision equal to the decimals parameter. If d is halfway between two numbers, one of which is even and the other odd, the mode parameter determines which of the two numbers is returned. If the precision of d is less than decimals , d is returned unchanged.
Exceptions
T:System.ArgumentOutOfRangeExceptiondecimals is less than 0 or greater than 28.
T:System.ArgumentExceptionmode is not a T:System.MidpointRounding value.
T:System.OverflowExceptionThe result is outside the range of a T:System.Decimal object.

Definition at line 846 of file Decimal.cs.

◆ Subtract()

static decimal System.Decimal.Subtract ( decimal  d1,
decimal  d2 
)
static

Subtracts one specified T:System.Decimal value from another.

Parameters
d1The minuend.
d2The subtrahend.
Returns
The result of subtracting d2 from d1 .
Exceptions
T:System.OverflowExceptionThe return value is less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue.

Definition at line 877 of file Decimal.cs.

◆ ToBoolean()

bool IConvertible. System.Decimal.ToBoolean ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToBoolean(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
true if the value of the current instance is not zero; otherwise, false.

Implements System.IConvertible.

Definition at line 1574 of file Decimal.cs.

◆ ToByte() [1/2]

static byte System.Decimal.ToByte ( decimal  value)
static

Converts the value of the specified T:System.Decimal to the equivalent 8-bit unsigned integer.

Parameters
valueThe decimal number to convert.
Returns
An 8-bit unsigned integer equivalent to value .
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Byte.MinValue or greater than F:System.Byte.MaxValue.

Definition at line 889 of file Decimal.cs.

◆ ToByte() [2/2]

byte IConvertible. System.Decimal.ToByte ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToByte(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Byte.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.Byte.MinValue or greater than F:System.Byte.MaxValue.

Implements System.IConvertible.

Definition at line 1604 of file Decimal.cs.

◆ ToChar()

char IConvertible. System.Decimal.ToChar ( IFormatProvider  provider)

This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
None. This conversion is not supported.
Exceptions
T:System.InvalidCastExceptionIn all cases.

Implements System.IConvertible.

Definition at line 1584 of file Decimal.cs.

◆ ToDateTime()

DateTime IConvertible. System.Decimal.ToDateTime ( IFormatProvider  provider)

This conversion is not supported. Attempting to use this method throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
None. This conversion is not supported.
Exceptions
T:System.InvalidCastExceptionIn all cases.

Implements System.IConvertible.

Definition at line 1701 of file Decimal.cs.

◆ ToDecimal()

decimal IConvertible. System.Decimal.ToDecimal ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToDecimal(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, unchanged.

Implements System.IConvertible.

Definition at line 1691 of file Decimal.cs.

◆ ToDouble() [1/2]

static double System.Decimal.ToDouble ( decimal  d)

Converts the value of the specified T:System.Decimal to the equivalent double-precision floating-point number.

Parameters
dThe decimal number to convert.
Returns
A double-precision floating-point number equivalent to d .

◆ ToDouble() [2/2]

double IConvertible. System.Decimal.ToDouble ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToDouble(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Double.

Implements System.IConvertible.

Definition at line 1682 of file Decimal.cs.

◆ ToInt16() [1/2]

static short System.Decimal.ToInt16 ( decimal  value)
static

Converts the value of the specified T:System.Decimal to the equivalent 16-bit signed integer.

Parameters
valueThe decimal number to convert.
Returns
A 16-bit signed integer equivalent to value .
Exceptions
T:System.OverflowExceptionvalue is less than F:System.Int16.MinValue or greater than F:System.Int16.MaxValue.

Definition at line 938 of file Decimal.cs.

◆ ToInt16() [2/2]

short IConvertible. System.Decimal.ToInt16 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt16(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Int16.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.Int16.MinValue or greater than F:System.Int16.MaxValue.

Implements System.IConvertible.

Definition at line 1614 of file Decimal.cs.

◆ ToInt32() [1/2]

static int System.Decimal.ToInt32 ( decimal  d)
static

Converts the value of the specified T:System.Decimal to the equivalent 32-bit signed integer.

Parameters
dThe decimal number to convert.
Returns
A 32-bit signed integer equivalent to the value of d .
Exceptions
T:System.OverflowExceptiond is less than F:System.Int32.MinValue or greater than F:System.Int32.MaxValue.

Definition at line 987 of file Decimal.cs.

◆ ToInt32() [2/2]

int IConvertible. System.Decimal.ToInt32 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider).

Parameters
providerThe parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Int32.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.Int32.MinValue or greater than F:System.Int32.MaxValue.

Implements System.IConvertible.

Definition at line 1634 of file Decimal.cs.

◆ ToInt64() [1/2]

static long System.Decimal.ToInt64 ( decimal  d)
static

Converts the value of the specified T:System.Decimal to the equivalent 64-bit signed integer.

Parameters
dThe decimal number to convert.
Returns
A 64-bit signed integer equivalent to the value of d .
Exceptions
T:System.OverflowExceptiond is less than F:System.Int64.MinValue or greater than F:System.Int64.MaxValue.

Definition at line 1022 of file Decimal.cs.

◆ ToInt64() [2/2]

long IConvertible. System.Decimal.ToInt64 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Int64.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.Int64.MinValue or greater than F:System.Int64.MaxValue.

Implements System.IConvertible.

Definition at line 1654 of file Decimal.cs.

◆ ToOACurrency()

static long System.Decimal.ToOACurrency ( decimal  value)
static

Converts the specified T:System.Decimal value to the equivalent OLE Automation Currency value, which is contained in a 64-bit signed integer.

Parameters
valueThe decimal number to convert.
Returns
A 64-bit signed integer that contains the OLE Automation equivalent of value .

Definition at line 173 of file Decimal.cs.

◆ ToSByte() [1/2]

static sbyte System.Decimal.ToSByte ( decimal  value)
static

Converts the value of the specified T:System.Decimal to the equivalent 8-bit signed integer.

Parameters
valueThe decimal number to convert.
Returns
An 8-bit signed integer equivalent to value .
Exceptions
T:System.OverflowExceptionvalue is less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue.

Definition at line 914 of file Decimal.cs.

◆ ToSByte() [2/2]

sbyte IConvertible. System.Decimal.ToSByte ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToSByte(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.SByte.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue.

Implements System.IConvertible.

Definition at line 1594 of file Decimal.cs.

◆ ToSingle() [1/2]

static float System.Decimal.ToSingle ( decimal  d)

Converts the value of the specified T:System.Decimal to the equivalent single-precision floating-point number.

Parameters
dThe decimal number to convert.
Returns
A single-precision floating-point number equivalent to the value of d .

◆ ToSingle() [2/2]

float IConvertible. System.Decimal.ToSingle ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToSingle(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.Single.

Implements System.IConvertible.

Definition at line 1673 of file Decimal.cs.

◆ ToString() [1/4]

override string System.Decimal.ToString ( )

Converts the numeric value of this instance to its equivalent string representation.

Returns
A string that represents the value of this instance.

Definition at line 464 of file Decimal.cs.

◆ ToString() [2/4]

string System.Decimal.ToString ( string  format)

Converts the numeric value of this instance to its equivalent string representation, using the specified format.

Parameters
formatA standard or custom numeric format string (see Remarks).
Returns
The string representation of the value of this instance as specified by format .
Exceptions
T:System.FormatExceptionformat is invalid.

Definition at line 476 of file Decimal.cs.

◆ ToString() [3/4]

string System.Decimal.ToString ( IFormatProvider  provider)

Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.

Parameters
providerAn object that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance as specified by provider .

Implements System.IConvertible.

Definition at line 486 of file Decimal.cs.

◆ ToString() [4/4]

string System.Decimal.ToString ( string  format,
IFormatProvider  provider 
)

Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.

Parameters
formatA numeric format string (see Remarks).
providerAn object that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance as specified by format and provider .
Exceptions
T:System.FormatExceptionformat is invalid.

Implements System.IFormattable.

Definition at line 499 of file Decimal.cs.

◆ ToType()

object IConvertible. System.Decimal.ToType ( Type  type,
IFormatProvider  provider 
)

For a description of this member, see M:System.IConvertible.ToType(System.Type,System.IFormatProvider).

Parameters
typeThe type to which to convert the value of this T:System.Decimal instance.
providerAn T:System.IFormatProvider implementation that supplies culture-specific information about the format of the returned value.
Returns
The value of the current instance, converted to a type .
Exceptions
T:System.ArgumentNullExceptiontype is null.
T:System.InvalidCastExceptionThe requested type conversion is not supported.

Implements System.IConvertible.

Definition at line 1714 of file Decimal.cs.

◆ ToUInt16() [1/2]

static ushort System.Decimal.ToUInt16 ( decimal  value)
static

Converts the value of the specified T:System.Decimal to the equivalent 16-bit unsigned integer.

Parameters
valueThe decimal number to convert.
Returns
A 16-bit unsigned integer equivalent to the value of value .
Exceptions
T:System.OverflowExceptionvalue is greater than F:System.UInt16.MaxValue or less than F:System.UInt16.MinValue.

Definition at line 1057 of file Decimal.cs.

◆ ToUInt16() [2/2]

ushort IConvertible. System.Decimal.ToUInt16 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToUInt16(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.UInt16.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.UInt16.MinValue or greater than F:System.UInt16.MaxValue.

Implements System.IConvertible.

Definition at line 1624 of file Decimal.cs.

◆ ToUInt32() [1/2]

static uint System.Decimal.ToUInt32 ( decimal  d)
static

Converts the value of the specified T:System.Decimal to the equivalent 32-bit unsigned integer.

Parameters
dThe decimal number to convert.
Returns
A 32-bit unsigned integer equivalent to the value of d .
Exceptions
T:System.OverflowExceptiond is negative or greater than F:System.UInt32.MaxValue.

Definition at line 1083 of file Decimal.cs.

◆ ToUInt32() [2/2]

uint IConvertible. System.Decimal.ToUInt32 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.UInt32.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.UInt32.MinValue or greater than F:System.UInt32.MaxValue.

Implements System.IConvertible.

Definition at line 1644 of file Decimal.cs.

◆ ToUInt64() [1/2]

static ulong System.Decimal.ToUInt64 ( decimal  d)
static

Converts the value of the specified T:System.Decimal to the equivalent 64-bit unsigned integer.

Parameters
dThe decimal number to convert.
Returns
A 64-bit unsigned integer equivalent to the value of d .
Exceptions
T:System.OverflowExceptiond is negative or greater than F:System.UInt64.MaxValue.

Definition at line 1108 of file Decimal.cs.

◆ ToUInt64() [2/2]

ulong IConvertible. System.Decimal.ToUInt64 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current instance, converted to a T:System.UInt64.
Exceptions
T:System.OverflowExceptionThe resulting integer value is less than F:System.UInt64.MinValue or greater than F:System.UInt64.MaxValue.

Implements System.IConvertible.

Definition at line 1664 of file Decimal.cs.

◆ Truncate()

static decimal System.Decimal.Truncate ( decimal  d)
static

Returns the integral digits of the specified T:System.Decimal; any fractional digits are discarded.

Parameters
dThe decimal number to truncate.
Returns
The result of d rounded toward zero, to the nearest whole number.

Definition at line 1138 of file Decimal.cs.

◆ TryParse() [1/2]

static bool System.Decimal.TryParse ( string  s,
out decimal  result 
)
static

Converts the string representation of a number to its T:System.Decimal equivalent. A return value indicates whether the conversion succeeded or failed.

Parameters
sThe string representation of the number to convert.
resultWhen this method returns, contains the T:System.Decimal number that is equivalent to the numeric value contained in s , if the conversion succeeded, or is zero if the conversion failed. The conversion fails if the s parameter is null or F:System.String.Empty, is not a number in a valid format, or represents a number less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
Returns
true if s was converted successfully; otherwise, false.

Definition at line 582 of file Decimal.cs.

◆ TryParse() [2/2]

static bool System.Decimal.TryParse ( string  s,
NumberStyles  style,
IFormatProvider  provider,
out decimal  result 
)
static

Converts the string representation of a number to its T:System.Decimal equivalent using the specified style and culture-specific format. A return value indicates whether the conversion succeeded or failed.

Parameters
sThe string representation of the number to convert.
styleA bitwise combination of enumeration values that indicates the permitted format of s . A typical value to specify is F:System.Globalization.NumberStyles.Number.
providerAn object that supplies culture-specific parsing information about s .
resultWhen this method returns, contains the T:System.Decimal number that is equivalent to the numeric value contained in s , if the conversion succeeded, or is zero if the conversion failed. The conversion fails if the s parameter is null or F:System.String.Empty, is not in a format compliant with style , or represents a number less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
Returns
true if s was converted successfully; otherwise, false.
Exceptions
T:System.ArgumentExceptionstyle is not a T:System.Globalization.NumberStyles value. -or- style is the F:System.Globalization.NumberStyles.AllowHexSpecifier value.

Definition at line 598 of file Decimal.cs.

Member Data Documentation

◆ MaxValue

const decimal System.Decimal.MaxValue = decimal.MaxValue

Represents the largest possible value of T:System.Decimal. This field is constant and read-only.

Definition at line 58 of file Decimal.cs.

◆ MinusOne

const decimal System.Decimal.MinusOne = -1m

Represents the number negative one (-1).

Definition at line 54 of file Decimal.cs.

◆ MinValue

const decimal System.Decimal.MinValue = decimal.MinValue

Represents the smallest possible value of T:System.Decimal. This field is constant and read-only.

Definition at line 62 of file Decimal.cs.

◆ One

const decimal System.Decimal.One = 1m

Represents the number one (1).

Definition at line 50 of file Decimal.cs.

◆ Zero

const decimal System.Decimal.Zero = 0m

Represents the number zero (0).

Definition at line 46 of file Decimal.cs.


The documentation for this struct was generated from the following file: