Creates a decimal from decimal Literal in CSharp

Description

The following code shows how to creates a decimal from decimal Literal.

Example


//from   w  ww  .  java 2 s  . c o m

public class MainClass{
  static void Main()
  {
    System.Console.WriteLine(1.618m);

        decimal d = 1;
        decimal d2 = 0.1M;
        System.Console.WriteLine(d - d2*10);

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var