2.30.3.Manually create a decimal number. |
|
Decimal offers eight public constructors. |
The following six are the most commonly used: |
- public Decimal(int v)
- public Decimal(uint v)
- public Decimal(long v)
- public Decimal(ulong v)
- public Decimal(float v)
- public Decimal(double v)
- public Decimal(int low, int middle, int high, bool signFlag, byte scaleFactor)
|
You can specify the constituents of a Decimal in an array of integers, using this constructor: |
public Decimal(int[ ] parts)
|
|
Decimal implements the following interfaces: |
- IComparable,
- IConvertible, and
- IFormattable.
|
using System;
class MainClass {
public static void Main() {
decimal d = new decimal(12345, 0, 0, false, 2);
Console.WriteLine(d);
}
}
|
|
123.45 |