The Methods and Fields Defined by Decimal : Decimal : Data Type C# Examples


C# Examples » Data Type » Decimal »

 

The Methods and Fields Defined by Decimal








Method
Meaning


public static decimal Add(decimal v1,decimal v2)
Returns v1 + v2.


public static int CompareTo(decimal v1,decimal v2)
Returns zero if the values are equal. Returns a negative value if v1 is less than v2. Returns a positive value if v1 is greater than v2.


public int CompareTo(object v)
Returns zero if the values are equal. Returns a negative value if the invoking object has a lower value. Returns a positive value if the invoking object has a greater value.


public static decimal Divide(decimal v1,decimal v2)
Returns v1 / v2.


public override bool Equals(object v)
Returns true if the value of the invoking object equals the value of v.


public static bool Equals(decimal v1,decimal v2)
Returns true if v1 equals v2.


public static decimal Floor(decimal v)
Returns the largest integer (represented as a decimal value) not greater than v. For example, given 1.02, Floor() returns 1.0. Given -1.02, Floor() returns -2.


public static decimalFromOACurrency(long v)
Converts the OLE Automation value in v into its decimal equivalent and returns the result.


public static int[ ] GetBits(decimal v)
Returns the binary representation of v and returns it in an array of ints. The organization of this array is as described in the text.


public override int GetHashCode()
Returns the hash code for the invoking object.


public TypeCode GetTypeCode()
Returns the TypeCode enumeration value for Decimal, which is TypeCode.Decimal.


public static decimal Multiply(decimal v1,decimal v2)
Returns v1 * v2.


public static decimal Negate(decimal v)
Returns -v.


public static decimal Parse(string str)
Returns the binary equivalent of the numeric string in str.


public static decimalParse(string str,IFormatProvider fmtpvdr)
Returns the binary equivalent of the numeric string in str using the culture-specific information provided by fmtpvdr.


public static decimalParse(string str, NumberStyles styles)
Returns the binary equivalent of the numeric string in str, using the style information provided by styles.


public static decimalParse(string str,NumberStyles styles,IFormatProvider fmtpvdr)
Returns the binary equivalent of the numeric string in str using the style information provided by styles and the culture-specific format information provided by fmtpvdr.


public static decimalRemainder(decimal v1, decimal v2)
Returns the remainder of the integer division v1 / v2.


public static decimalRound(decimal v, int decPlaces)
Returns the value of v rounded to the number of decimal places specified by decPlaces, which must be between 0 and 28.


public static decimalSubtract(decimal v1, decimal v2)
Returns v1 - v2.


public static byte ToByte(decimal v)
Returns the byte equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of a byte.


public static double ToDouble(decimal v)
Returns the double equivalent of v. A loss of precision may occur because double has fewer significant digits than does decimal.


public static short ToInt16(decimal v)
Returns the short equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of a short.


public static int ToInt32(decimal v)
Returns the int equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of an int.


public static long ToInt64(decimal v)
Returns the long equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of a long.


public static longToOACurrency(decimal v)
Converts v into the equivalent OLE Automation value and returns the result.


public static sbyte ToSByte(decimal v)
Returns the sbyte equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of an sbyte.


public static float ToSingle(decimal v)
Returns the float equivalent of v. A loss of precision may occur because float has fewer significant digits than does decimal.


public override string ToString()
Returns the string representation of the value of the invoking object.


public string ToString(string format)
Returns the string representation of the value of the invoking object as specified by the format string passed in format.


public stringToString(IFormatProvider fmtpvdr)
Returns the string representation of the value of the invoking object using the culture-specific information specified in fmtpvdr.


public stringToString(string format,IFormatProvider fmtpvdr)
Returns the string representation of the value of the invoking object using the culture-specific information specified in fmtpvdr and the format specified by format.


public static ushort ToUInt16(decimal v)
Returns the ushort equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of a ushort.


public static uint ToUInt32(decimal v)
Returns the uint equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of a uint.


public static ulong ToUInt64(decimal v)
Returns the ulong equivalent of v. Any fractional component is truncated. An OverflowException occurs if v is not within the range of a ulong.


public static decimal Truncate(decimal v)
Returns the whole-number portion of v. Thus, it truncates any fractional digits.






Field
Meaning


public static readonly decimal MaxValue
The largest value that a decimal can hold.


public static readonly decimal MinusOne
The decimal representation of -1.


public static readonly decimal MinValue
The smallest value that a decimal can hold.


public static readonly decimal One
The decimal representation of 1.


public static readonly decimal Zero
The decimal representation of 0.






HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Decimal