MSDN Documentation

System.Decimal Structure

Namespace: System

The Decimal structure represents a 128-bit data type suitable for financial and monetary calculations where precision is critical. It provides 28-29 significant digits.

Syntax

public struct Decimal : IComparable, IComparable<Decimal>, IConvertible, IEquatable<Decimal>, IFormattable

Properties

NameTypeDescription
ZeroDecimalConstant representing the value 0.
OneDecimalConstant representing the value 1.
MinValueDecimalSmallest possible value.
MaxValueDecimalLargest possible value.

Methods

NameSignatureDescription
Addstatic Decimal Add(Decimal d1, Decimal d2)Returns the sum of two decimals.
Subtractstatic Decimal Subtract(Decimal d1, Decimal d2)Returns the difference of two decimals.
Multiplystatic Decimal Multiply(Decimal d1, Decimal d2)Returns the product of two decimals.
Dividestatic Decimal Divide(Decimal d1, Decimal d2)Returns the quotient of two decimals.
Parsestatic Decimal Parse(string s)Converts a string representation of a number to a decimal.
TryParsestatic bool TryParse(string s, out Decimal result)Tries to convert a string to a decimal.
ToStringstring ToString(string format, IFormatProvider provider)Formats the value using specified format and culture.

Example: Interactive Decimal Calculator

See Also