struct decimal

in global :: System

Represents a decimal floating-point number.


public decimal( double value )

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

  • value The value to represent as a .

public decimal( int value )

Initializes a new instance of to the value of the specified 32-bit signed integer.

  • value The value to represent as a .

public decimal( int lo, int mid, int hi, bool isNegative, byte scale )

Initializes a new instance of from parameters specifying the instance's constituent parts.

  • lo The low 32 bits of a 96-bit integer.
  • mid The middle 32 bits of a 96-bit integer.
  • hi The high 32 bits of a 96-bit integer.
  • isNegative to indicate a negative number; to indicate a positive number.
  • scale A power of 10 ranging from 0 to 28.

public decimal( int[] bits )

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

  • bits An array of 32-bit signed integers containing a representation of a decimal value.

public decimal( long value )

Initializes a new instance of to the value of the specified 64-bit signed integer.

  • value The value to represent as a .

public decimal( float value )

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

  • value The value to represent as a .

public decimal( uint value )

Initializes a new instance of to the value of the specified 32-bit unsigned integer.

  • value The value to represent as a .

public decimal( ulong value )

Initializes a new instance of to the value of the specified 64-bit unsigned integer.

  • value The value to represent as a .

public static decimal Add( decimal d1, decimal d2 )

Adds two specified values.

  • d1 The first value to add.
  • d2 The second value to add.
  • Returns The sum of and .

public static decimal Ceiling( decimal d )

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

  • d A decimal number.
  • Returns The smallest integral value that is greater than or equal to the parameter. Note that this method returns a instead of an integral type.

public static int Compare( decimal d1, decimal d2 )

Compares two specified values.

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

public int CompareTo( decimal value )

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

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

public int CompareTo( object value )

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

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

public static decimal Divide( decimal d1, decimal d2 )

Divides two specified values.

  • d1 The dividend.
  • d2 The divisor.
  • Returns The result of dividing by .

public bool Equals( decimal value )

Returns a value indicating whether this instance and a specified object represent the same value.

  • value An object to compare to this instance.
  • Returns if is equal to this instance; otherwise, .

public static bool Equals( decimal d1, decimal d2 )

Returns a value indicating whether two specified instances of represent the same value.

  • d1 The first value to compare.
  • d2 The second value to compare.
  • Returns if and are equal; otherwise, .

public bool Equals( object value )

Returns a value indicating whether this instance and a specified represent the same type and value.

  • value The object to compare with this instance.
  • Returns if is a and equal to this instance; otherwise, .

public static decimal Floor( decimal d )

Rounds a specified number to the closest integer toward negative infinity.

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

public static decimal FromOACurrency( long cy )

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

  • cy An OLE Automation Currency value.
  • Returns A that contains the equivalent of .

public static int[] GetBits( decimal d )

Converts the value of a specified instance of to its equivalent binary representation.

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

public static decimal MaxValue

Represents the largest possible value of . This field is constant and read-only.

public static decimal MinusOne

Represents the number negative one (-1).

public static decimal MinValue

Represents the smallest possible value of . This field is constant and read-only.

public static decimal Multiply( decimal d1, decimal d2 )

Multiplies two specified values.

  • d1 The multiplicand.
  • d2 The multiplier.
  • Returns The result of multiplying and .

public static decimal Negate( decimal d )

Returns the result of multiplying the specified value by negative one.

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

public static decimal One

Represents the number one (1).

public static decimal op_Addition( decimal d1, decimal d2 )

Adds two specified values.

  • d1 The first value to add.
  • d2 The second value to add.
  • Returns The result of adding and .

public static decimal op_Decrement( decimal d )

Decrements the operand by one.

  • d The value to decrement.
  • Returns The value of decremented by 1.

public static decimal op_Division( decimal d1, decimal d2 )

Divides two specified values.

  • d1 The dividend.
  • d2 The divisor.
  • Returns The result of dividing by .

public static bool op_Equality( decimal d1, decimal d2 )

Returns a value that indicates whether two values are equal.

  • d1 The first value to compare.
  • d2 The second value to compare.
  • Returns if and are equal; otherwise, .

public static bool op_GreaterThan( decimal d1, decimal d2 )

Returns a value indicating whether a specified is greater than another specified .

  • d1 The first value to compare.
  • d2 The second value to compare.
  • Returns if is greater than ; otherwise, .

public static bool op_GreaterThanOrEqual( decimal d1, decimal d2 )

Returns a value indicating whether a specified is greater than or equal to another specified .

  • d1 The first value to compare.
  • d2 The second value to compare.
  • Returns if is greater than or equal to ; otherwise, .

public static decimal op_Increment( decimal d )

Increments the operand by 1.

  • d The value to increment.
  • Returns The value of incremented by 1.

public static bool op_Inequality( decimal d1, decimal d2 )

Returns a value that indicates whether two objects have different values.

  • d1 The first value to compare.
  • d2 The second value to compare.
  • Returns if and are not equal; otherwise, .

public static bool op_LessThan( decimal d1, decimal d2 )

Returns a value indicating whether a specified is less than another specified .

  • d1 The first value to compare.
  • d2 The second value to compare.
  • Returns if is less than ; otherwise, .

public static bool op_LessThanOrEqual( decimal d1, decimal d2 )

Returns a value indicating whether a specified is less than or equal to another specified .

  • d1 The first value to compare.
  • d2 The second value to compare.
  • Returns if is less than or equal to ; otherwise, .

public static decimal op_Modulus( decimal d1, decimal d2 )

Returns the remainder resulting from dividing two specified values.

  • d1 The dividend.
  • d2 The divisor.
  • Returns The remainder resulting from dividing by .

public static decimal op_Multiply( decimal d1, decimal d2 )

Multiplies two specified values.

  • d1 The first value to multiply.
  • d2 The second value to multiply.
  • Returns The result of multiplying by .

public static decimal op_Subtraction( decimal d1, decimal d2 )

Subtracts two specified values.

  • d1 The minuend.
  • d2 The subtrahend.
  • Returns The result of subtracting from .

public static decimal op_UnaryNegation( decimal d )

Negates the value of the specified operand.

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

public static decimal op_UnaryPlus( decimal d )

Returns the value of the operand (the sign of the operand is unchanged).

  • d The operand to return.
  • Returns The value of the operand, .

public static decimal Parse( string s )

Converts the string representation of a number to its equivalent.

  • s The string representation of the number to convert.
  • Returns The equivalent to the number contained in .

public static decimal Parse( string s, NumberStyles style )

Converts the string representation of a number in a specified style to its equivalent.

  • s The string representation of the number to convert.
  • style A bitwise combination of values that indicates the style elements that can be present in . A typical value to specify is .
  • Returns The number equivalent to the number contained in as specified by .

public static decimal Parse( string s, NumberStyles style, IFormatProvider provider )

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

  • s The string representation of the number to convert.
  • style A bitwise combination of values that indicates the style elements that can be present in . A typical value to specify is .
  • provider An object that supplies culture-specific information about the format of .
  • Returns The number equivalent to the number contained in as specified by and .

public static decimal Parse( string s, IFormatProvider provider )

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

  • s The string representation of the number to convert.
  • provider An that supplies culture-specific parsing information about .
  • Returns The number equivalent to the number contained in as specified by .

public static decimal Remainder( decimal d1, decimal d2 )

Computes the remainder after dividing two values.

  • d1 The dividend.
  • d2 The divisor.
  • Returns The remainder after dividing by .

public static decimal Round( decimal d )

Rounds a decimal value to the nearest integer.

  • d A decimal number to round.
  • Returns The integer that is nearest to the parameter. If is halfway between two integers, one of which is even and the other odd, the even number is returned.

public static decimal Round( decimal d, int decimals )

Rounds a value to a specified number of decimal places.

  • d A decimal number to round.
  • decimals A value from 0 to 28 that specifies the number of decimal places to round to.
  • Returns The decimal number equivalent to rounded to number of decimal places.

public 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.

  • d A decimal number to round.
  • decimals The number of significant decimal places (precision) in the return value.
  • mode A value that specifies how to round if it is midway between two other numbers.
  • Returns The number that is nearest to the parameter with a precision equal to the parameter. If is halfway between two numbers, one of which is even and the other odd, the parameter determines which of the two numbers is returned. If the precision of is less than , is returned unchanged.

public 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.

  • d A decimal number to round.
  • mode A value that specifies how to round if it is midway between two other numbers.
  • Returns The integer that is nearest to the parameter. If is halfway between two numbers, one of which is even and the other odd, the parameter determines which of the two numbers is returned.

public static decimal Subtract( decimal d1, decimal d2 )

Subtracts one specified value from another.

  • d1 The minuend.
  • d2 The subtrahend.
  • Returns The result of subtracting from .

public static byte ToByte( decimal value )

Converts the value of the specified to the equivalent 8-bit unsigned integer.

  • value The decimal number to convert.
  • Returns An 8-bit unsigned integer equivalent to .

public static double ToDouble( decimal d )

Converts the value of the specified to the equivalent double-precision floating-point number.

  • d The decimal number to convert.
  • Returns A double-precision floating-point number equivalent to .

public static short ToInt16( decimal value )

Converts the value of the specified to the equivalent 16-bit signed integer.

  • value The decimal number to convert.
  • Returns A 16-bit signed integer equivalent to .

public static int ToInt32( decimal d )

Converts the value of the specified to the equivalent 32-bit signed integer.

  • d The decimal number to convert.
  • Returns A 32-bit signed integer equivalent to the value of .

public static long ToInt64( decimal d )

Converts the value of the specified to the equivalent 64-bit signed integer.

  • d The decimal number to convert.
  • Returns A 64-bit signed integer equivalent to the value of .

public static long ToOACurrency( decimal value )

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

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

public static sbyte ToSByte( decimal value )

Converts the value of the specified to the equivalent 8-bit signed integer.

  • value The decimal number to convert.
  • Returns An 8-bit signed integer equivalent to .

public static float ToSingle( decimal d )

Converts the value of the specified to the equivalent single-precision floating-point number.

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

public string ToString( IFormatProvider provider )

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

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

public string ToString( string format )

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

  • format A standard or custom numeric format string.
  • Returns The string representation of the value of this instance as specified by .

public 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.

  • format A numeric format string.
  • provider An object that supplies culture-specific formatting information.
  • Returns The string representation of the value of this instance as specified by and .

public static ushort ToUInt16( decimal value )

Converts the value of the specified to the equivalent 16-bit unsigned integer.

  • value The decimal number to convert.
  • Returns A 16-bit unsigned integer equivalent to the value of .

public static uint ToUInt32( decimal d )

Converts the value of the specified to the equivalent 32-bit unsigned integer.

  • d The decimal number to convert.
  • Returns A 32-bit unsigned integer equivalent to the value of .

public static ulong ToUInt64( decimal d )

Converts the value of the specified to the equivalent 64-bit unsigned integer.

  • d The decimal number to convert.
  • Returns A 64-bit unsigned integer equivalent to the value of .

public static decimal Truncate( decimal d )

Returns the integral digits of the specified ; any fractional digits are discarded.

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

public static bool TryParse( string s, ref decimal result )

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

  • s The string representation of the number to convert.
  • result When this method returns, contains the number that is equivalent to the numeric value contained in , if the conversion succeeded, or zero if the conversion failed. The conversion fails if the parameter is or , is not a number in a valid format, or represents a number less than or greater than . This parameter is passed uininitialized; any value originally supplied in is overwritten.
  • Returns if was converted successfully; otherwise, .

public static bool TryParse( string s, NumberStyles style, IFormatProvider provider, ref decimal result )

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

  • s The string representation of the number to convert.
  • style A bitwise combination of enumeration values that indicates the permitted format of . A typical value to specify is .
  • provider An object that supplies culture-specific parsing information about .
  • result When this method returns, contains the number that is equivalent to the numeric value contained in , if the conversion succeeded, or zero if the conversion failed. The conversion fails if the parameter is or , is not a number in a format compliant with , or represents a number less than or greater than . This parameter is passed uininitialized; any value originally supplied in is overwritten.
  • Returns if was converted successfully; otherwise, .

public static decimal Zero

Represents the number zero (0).

public static decimal CreateTruncating( TOther value )

😔 No documentation found.

public static decimal CreateSaturating( TOther value )

😔 No documentation found.

public static decimal MaxMagnitude( decimal x, decimal y )

😔 No documentation found.

public static bool IsOddInteger( decimal value )

😔 No documentation found.

public static bool IsEvenInteger( decimal value )

😔 No documentation found.

public static bool IsNegative( decimal value )

😔 No documentation found.

public static bool IsInteger( decimal value )

😔 No documentation found.

public static bool IsCanonical( decimal value )

😔 No documentation found.

public static bool IsPositive( decimal value )

😔 No documentation found.

public static decimal Abs( decimal value )

😔 No documentation found.

public static decimal Parse( ReadOnlySpan<byte> utf8Text, NumberStyles style = Number, IFormatProvider provider = null )

😔 No documentation found.

public static decimal Parse( ReadOnlySpan<char> s, NumberStyles style = Number, IFormatProvider provider = null )

😔 No documentation found.

public byte Scale { get; }

😔 No documentation found.

public decimal( ReadOnlySpan<int> bits )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public bool TryFormat( Span<char> destination, ref int charsWritten, ReadOnlySpan<char> format = null, IFormatProvider provider = null )

😔 No documentation found.

public static decimal MinMagnitude( decimal x, decimal y )

😔 No documentation found.

public bool TryFormat( Span<byte> utf8Destination, ref int bytesWritten, ReadOnlySpan<char> format = null, IFormatProvider provider = null )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<byte> utf8Text, IFormatProvider provider, ref decimal result )

😔 No documentation found.

public static decimal Parse( ReadOnlySpan<byte> utf8Text, IFormatProvider provider )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<byte> utf8Text, NumberStyles style, IFormatProvider provider, ref decimal result )

😔 No documentation found.

public static decimal CreateChecked( TOther value )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<char> s, IFormatProvider provider, ref decimal result )

😔 No documentation found.

public static decimal Parse( ReadOnlySpan<char> s, IFormatProvider provider )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public static bool TryParse( string s, IFormatProvider provider, ref decimal result )

😔 No documentation found.

public static char op_Explicit( decimal value )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<char> s, ref decimal result )

😔 No documentation found.

public static decimal op_Implicit( byte value )

😔 No documentation found.

public static decimal op_Implicit( sbyte value )

😔 No documentation found.

public static decimal op_Implicit( short value )

😔 No documentation found.

public static decimal op_Implicit( ushort value )

😔 No documentation found.

public static decimal op_Implicit( char value )

😔 No documentation found.

public static decimal op_Implicit( int value )

😔 No documentation found.

public static decimal op_Implicit( uint value )

😔 No documentation found.

public static decimal op_Implicit( long value )

😔 No documentation found.

public static decimal op_Implicit( ulong value )

😔 No documentation found.

public static decimal op_Explicit( float value )

😔 No documentation found.

public static decimal op_Explicit( double value )

😔 No documentation found.

public static byte op_Explicit( decimal value )

😔 No documentation found.

public static sbyte op_Explicit( decimal value )

😔 No documentation found.

public static short op_Explicit( decimal value )

😔 No documentation found.

public static ushort op_Explicit( decimal value )

😔 No documentation found.

public static int op_Explicit( decimal value )

😔 No documentation found.

public static decimal Min( decimal x, decimal y )

😔 No documentation found.

public static decimal Max( decimal x, decimal y )

😔 No documentation found.

public static decimal CopySign( decimal value, decimal sign )

😔 No documentation found.

public static decimal Clamp( decimal value, decimal min, decimal max )

😔 No documentation found.

public static TInteger ConvertToIntegerNative( decimal value )

😔 No documentation found.

public static TInteger ConvertToInteger( decimal value )

😔 No documentation found.

public TypeCode GetTypeCode( )

😔 No documentation found.

public static int Sign( decimal d )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<byte> utf8Text, ref decimal result )

😔 No documentation found.

public static int GetBits( decimal d, Span<int> destination )

😔 No documentation found.

public static bool TryGetBits( decimal d, Span<int> destination, ref int valuesWritten )

😔 No documentation found.

public static double op_Explicit( decimal value )

😔 No documentation found.

public static float op_Explicit( decimal value )

😔 No documentation found.

public static ulong op_Explicit( decimal value )

😔 No documentation found.

public static long op_Explicit( decimal value )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<char> s, NumberStyles style, IFormatProvider provider, ref decimal result )

😔 No documentation found.

public static uint op_Explicit( decimal value )

😔 No documentation found.