Decimal 結構
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表十進位浮點數。
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IFormattable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IFormattable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, ISpanFormattable, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IParsable<System::Decimal>, ISpanParsable<System::Decimal>, System::Numerics::IAdditionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IAdditiveIdentity<System::Decimal, System::Decimal>, System::Numerics::IComparisonOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IDecrementOperators<System::Decimal>, System::Numerics::IDivisionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IEqualityOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IFloatingPoint<System::Decimal>, System::Numerics::IFloatingPointConstants<System::Decimal>, System::Numerics::IIncrementOperators<System::Decimal>, System::Numerics::IMinMaxValue<System::Decimal>, System::Numerics::IModulusOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IMultiplicativeIdentity<System::Decimal, System::Decimal>, System::Numerics::IMultiplyOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::INumber<System::Decimal>, System::Numerics::INumberBase<System::Decimal>, System::Numerics::ISignedNumber<System::Decimal>, System::Numerics::ISubtractionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IUnaryNegationOperators<System::Decimal, System::Decimal>, System::Numerics::IUnaryPlusOperators<System::Decimal, System::Decimal>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IParsable<System::Decimal>, ISpanParsable<System::Decimal>, IUtf8SpanParsable<System::Decimal>, System::Numerics::IAdditionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IAdditiveIdentity<System::Decimal, System::Decimal>, System::Numerics::IComparisonOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IDecrementOperators<System::Decimal>, System::Numerics::IDivisionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IEqualityOperators<System::Decimal, System::Decimal, bool>, System::Numerics::IFloatingPoint<System::Decimal>, System::Numerics::IFloatingPointConstants<System::Decimal>, System::Numerics::IIncrementOperators<System::Decimal>, System::Numerics::IMinMaxValue<System::Decimal>, System::Numerics::IModulusOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IMultiplicativeIdentity<System::Decimal, System::Decimal>, System::Numerics::IMultiplyOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::INumber<System::Decimal>, System::Numerics::INumberBase<System::Decimal>, System::Numerics::ISignedNumber<System::Decimal>, System::Numerics::ISubtractionOperators<System::Decimal, System::Decimal, System::Decimal>, System::Numerics::IUnaryNegationOperators<System::Decimal, System::Decimal>, System::Numerics::IUnaryPlusOperators<System::Decimal, System::Decimal>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IConvertible, IEquatable<System::Decimal>, IFormattable, System::Runtime::Serialization::IDeserializationCallback
public value class System::Decimal : IComparable, IConvertible, IFormattable
public value class System::Decimal : IComparable, IComparable<System::Decimal>, IEquatable<System::Decimal>, IFormattable
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable
public readonly struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, ISpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct Decimal : IComparable<decimal>, IConvertible, IEquatable<decimal>, IParsable<decimal>, ISpanParsable<decimal>, System.Numerics.IAdditionOperators<decimal,decimal,decimal>, System.Numerics.IAdditiveIdentity<decimal,decimal>, System.Numerics.IComparisonOperators<decimal,decimal,bool>, System.Numerics.IDecrementOperators<decimal>, System.Numerics.IDivisionOperators<decimal,decimal,decimal>, System.Numerics.IEqualityOperators<decimal,decimal,bool>, System.Numerics.IFloatingPoint<decimal>, System.Numerics.IFloatingPointConstants<decimal>, System.Numerics.IIncrementOperators<decimal>, System.Numerics.IMinMaxValue<decimal>, System.Numerics.IModulusOperators<decimal,decimal,decimal>, System.Numerics.IMultiplicativeIdentity<decimal,decimal>, System.Numerics.IMultiplyOperators<decimal,decimal,decimal>, System.Numerics.INumber<decimal>, System.Numerics.INumberBase<decimal>, System.Numerics.ISignedNumber<decimal>, System.Numerics.ISubtractionOperators<decimal,decimal,decimal>, System.Numerics.IUnaryNegationOperators<decimal,decimal>, System.Numerics.IUnaryPlusOperators<decimal,decimal>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public readonly struct Decimal : IComparable<decimal>, IConvertible, IEquatable<decimal>, IParsable<decimal>, ISpanParsable<decimal>, IUtf8SpanParsable<decimal>, System.Numerics.IAdditionOperators<decimal,decimal,decimal>, System.Numerics.IAdditiveIdentity<decimal,decimal>, System.Numerics.IComparisonOperators<decimal,decimal,bool>, System.Numerics.IDecrementOperators<decimal>, System.Numerics.IDivisionOperators<decimal,decimal,decimal>, System.Numerics.IEqualityOperators<decimal,decimal,bool>, System.Numerics.IFloatingPoint<decimal>, System.Numerics.IFloatingPointConstants<decimal>, System.Numerics.IIncrementOperators<decimal>, System.Numerics.IMinMaxValue<decimal>, System.Numerics.IModulusOperators<decimal,decimal,decimal>, System.Numerics.IMultiplicativeIdentity<decimal,decimal>, System.Numerics.IMultiplyOperators<decimal,decimal,decimal>, System.Numerics.INumber<decimal>, System.Numerics.INumberBase<decimal>, System.Numerics.ISignedNumber<decimal>, System.Numerics.ISubtractionOperators<decimal,decimal,decimal>, System.Numerics.IUnaryNegationOperators<decimal,decimal>, System.Numerics.IUnaryPlusOperators<decimal,decimal>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback
public readonly struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback
[System.Serializable]
public struct Decimal : IComparable, IConvertible, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Decimal : IComparable, IComparable<decimal>, IConvertible, IEquatable<decimal>, IFormattable, System.Runtime.Serialization.IDeserializationCallback
public struct Decimal : IComparable, IComparable<decimal>, IEquatable<decimal>, IFormattable
type decimal = struct
interface IConvertible
interface IFormattable
type decimal = struct
interface IConvertible
interface IFormattable
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface ISpanFormattable
interface IFormattable
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface IFormattable
interface IParsable<decimal>
interface ISpanFormattable
interface ISpanParsable<decimal>
interface IAdditionOperators<decimal, decimal, decimal>
interface IAdditiveIdentity<decimal, decimal>
interface IComparisonOperators<decimal, decimal, bool>
interface IEqualityOperators<decimal, decimal, bool>
interface IDecrementOperators<decimal>
interface IDivisionOperators<decimal, decimal, decimal>
interface IFloatingPoint<decimal>
interface IFloatingPointConstants<decimal>
interface INumberBase<decimal>
interface IIncrementOperators<decimal>
interface IMultiplicativeIdentity<decimal, decimal>
interface IMultiplyOperators<decimal, decimal, decimal>
interface ISubtractionOperators<decimal, decimal, decimal>
interface IUnaryNegationOperators<decimal, decimal>
interface IUnaryPlusOperators<decimal, decimal>
interface IModulusOperators<decimal, decimal, decimal>
interface INumber<decimal>
interface ISignedNumber<decimal>
interface IMinMaxValue<decimal>
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface IFormattable
interface IParsable<decimal>
interface ISpanFormattable
interface ISpanParsable<decimal>
interface IAdditionOperators<decimal, decimal, decimal>
interface IAdditiveIdentity<decimal, decimal>
interface IComparisonOperators<decimal, decimal, bool>
interface IEqualityOperators<decimal, decimal, bool>
interface IDecrementOperators<decimal>
interface IDivisionOperators<decimal, decimal, decimal>
interface IFloatingPoint<decimal>
interface IFloatingPointConstants<decimal>
interface INumberBase<decimal>
interface IIncrementOperators<decimal>
interface IMultiplicativeIdentity<decimal, decimal>
interface IMultiplyOperators<decimal, decimal, decimal>
interface ISubtractionOperators<decimal, decimal, decimal>
interface IUnaryNegationOperators<decimal, decimal>
interface IUnaryPlusOperators<decimal, decimal>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<decimal>
interface IModulusOperators<decimal, decimal, decimal>
interface INumber<decimal>
interface ISignedNumber<decimal>
interface IMinMaxValue<decimal>
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface IFormattable
interface IParsable<decimal>
interface ISpanFormattable
interface ISpanParsable<decimal>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<decimal>
interface IAdditionOperators<decimal, decimal, decimal>
interface IAdditiveIdentity<decimal, decimal>
interface IComparisonOperators<decimal, decimal, bool>
interface IEqualityOperators<decimal, decimal, bool>
interface IDecrementOperators<decimal>
interface IDivisionOperators<decimal, decimal, decimal>
interface IFloatingPoint<decimal>
interface IFloatingPointConstants<decimal>
interface IIncrementOperators<decimal>
interface IMultiplicativeIdentity<decimal, decimal>
interface IMultiplyOperators<decimal, decimal, decimal>
interface INumberBase<decimal>
interface ISubtractionOperators<decimal, decimal, decimal>
interface IUnaryNegationOperators<decimal, decimal>
interface IUnaryPlusOperators<decimal, decimal>
interface IModulusOperators<decimal, decimal, decimal>
interface INumber<decimal>
interface ISignedNumber<decimal>
interface IMinMaxValue<decimal>
interface IDeserializationCallback
interface ISerializable
type decimal = struct
interface IConvertible
interface IFormattable
interface IDeserializationCallback
[<System.Serializable>]
type decimal = struct
interface IFormattable
interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type decimal = struct
interface IFormattable
interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type decimal = struct
interface IFormattable
interface IConvertible
interface IDeserializationCallback
type decimal = struct
interface IFormattable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IEquatable(Of Decimal), IFormattable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IDeserializationCallback, IEquatable(Of Decimal), IFormattable, ISerializable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IDeserializationCallback, IEquatable(Of Decimal), ISerializable, ISpanFormattable
Public Structure Decimal
Implements IAdditionOperators(Of Decimal, Decimal, Decimal), IAdditiveIdentity(Of Decimal, Decimal), IComparable(Of Decimal), IComparisonOperators(Of Decimal, Decimal, Boolean), IConvertible, IDecrementOperators(Of Decimal), IDeserializationCallback, IDivisionOperators(Of Decimal, Decimal, Decimal), IEqualityOperators(Of Decimal, Decimal, Boolean), IEquatable(Of Decimal), IFloatingPoint(Of Decimal), IFloatingPointConstants(Of Decimal), IIncrementOperators(Of Decimal), IMinMaxValue(Of Decimal), IModulusOperators(Of Decimal, Decimal, Decimal), IMultiplicativeIdentity(Of Decimal, Decimal), IMultiplyOperators(Of Decimal, Decimal, Decimal), INumber(Of Decimal), INumberBase(Of Decimal), IParsable(Of Decimal), ISerializable, ISignedNumber(Of Decimal), ISpanParsable(Of Decimal), ISubtractionOperators(Of Decimal, Decimal, Decimal), IUnaryNegationOperators(Of Decimal, Decimal), IUnaryPlusOperators(Of Decimal, Decimal)
Public Structure Decimal
Implements IAdditionOperators(Of Decimal, Decimal, Decimal), IAdditiveIdentity(Of Decimal, Decimal), IComparable(Of Decimal), IComparisonOperators(Of Decimal, Decimal, Boolean), IConvertible, IDecrementOperators(Of Decimal), IDeserializationCallback, IDivisionOperators(Of Decimal, Decimal, Decimal), IEqualityOperators(Of Decimal, Decimal, Boolean), IEquatable(Of Decimal), IFloatingPoint(Of Decimal), IFloatingPointConstants(Of Decimal), IIncrementOperators(Of Decimal), IMinMaxValue(Of Decimal), IModulusOperators(Of Decimal, Decimal, Decimal), IMultiplicativeIdentity(Of Decimal, Decimal), IMultiplyOperators(Of Decimal, Decimal, Decimal), INumber(Of Decimal), INumberBase(Of Decimal), IParsable(Of Decimal), ISerializable, ISignedNumber(Of Decimal), ISpanParsable(Of Decimal), ISubtractionOperators(Of Decimal, Decimal, Decimal), IUnaryNegationOperators(Of Decimal, Decimal), IUnaryPlusOperators(Of Decimal, Decimal), IUtf8SpanParsable(Of Decimal)
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IConvertible, IDeserializationCallback, IEquatable(Of Decimal), IFormattable
Public Structure Decimal
Implements IComparable, IConvertible, IFormattable
Public Structure Decimal
Implements IComparable, IComparable(Of Decimal), IEquatable(Of Decimal), IFormattable
- 繼承
- 屬性
- 實作
-
IComparable IComparable<Decimal> IConvertible IEquatable<Decimal> IFormattable IDeserializationCallback ISerializable ISpanFormattable IComparable<TSelf> IEquatable<TSelf> IParsable<Decimal> IParsable<TSelf> ISpanParsable<Decimal> ISpanParsable<TSelf> IAdditionOperators<Decimal,Decimal,Decimal> IAdditionOperators<TSelf,TSelf,TSelf> IAdditiveIdentity<Decimal,Decimal> IAdditiveIdentity<TSelf,TSelf> IComparisonOperators<Decimal,Decimal,Boolean> IComparisonOperators<TSelf,TSelf,Boolean> IDecrementOperators<Decimal> IDecrementOperators<TSelf> IDivisionOperators<Decimal,Decimal,Decimal> IDivisionOperators<TSelf,TSelf,TSelf> IEqualityOperators<Decimal,Decimal,Boolean> IEqualityOperators<TSelf,TOther,TResult> IEqualityOperators<TSelf,TSelf,Boolean> IFloatingPoint<Decimal> IFloatingPointConstants<Decimal> IFloatingPointConstants<TSelf> IIncrementOperators<Decimal> IIncrementOperators<TSelf> IMinMaxValue<Decimal> IModulusOperators<Decimal,Decimal,Decimal> IModulusOperators<TSelf,TSelf,TSelf> IMultiplicativeIdentity<Decimal,Decimal> IMultiplicativeIdentity<TSelf,TSelf> IMultiplyOperators<Decimal,Decimal,Decimal> IMultiplyOperators<TSelf,TSelf,TSelf> INumber<Decimal> INumber<TSelf> INumberBase<Decimal> INumberBase<TSelf> ISignedNumber<Decimal> ISignedNumber<TSelf> ISubtractionOperators<Decimal,Decimal,Decimal> ISubtractionOperators<TSelf,TSelf,TSelf> IUnaryNegationOperators<Decimal,Decimal> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<Decimal,Decimal> IUnaryPlusOperators<TSelf,TSelf> IUtf8SpanFormattable IUtf8SpanParsable<Decimal> IUtf8SpanParsable<TSelf>
備註
如需此 API 的詳細資訊,請參閱 小數點補充 API 備註。
建構函式
Decimal(Double) |
將 Decimal 的新執行個體初始化為指定雙精確度浮點數的值。 |
Decimal(Int32) |
將 Decimal 的新執行個體初始化為指定 32 位元帶正負號整數的值。 |
Decimal(Int32, Int32, Int32, Boolean, Byte) |
從指定執行個體組成部分的參數,初始化 Decimal 的新執行個體。 |
Decimal(Int32[]) |
將 Decimal 的新執行個體初始化為以二進位表示並包含在指定陣列中的十進位值。 |
Decimal(Int64) |
將 Decimal 的新執行個體初始化為指定 64 位元帶正負號整數的值。 |
Decimal(ReadOnlySpan<Int32>) |
將 Decimal 的新執行個體初始化為十進位值,以二進位表示,並包含在指定範圍內。 |
Decimal(Single) |
將 Decimal 的新執行個體初始化為指定單精確度浮點數的值。 |
Decimal(UInt32) |
將 Decimal 的新執行個體初始化為指定 32 位元不帶正負號整數的值。 |
Decimal(UInt64) |
將 Decimal 的新執行個體初始化為指定 64 位元不帶正負號整數的值。 |
欄位
MaxValue |
代表 Decimal 最大的可能值。 這個欄位是不變且唯讀的。 |
MinusOne |
表示數字負一 (-1)。 |
MinValue |
代表 Decimal 最小的可能值。 這個欄位是不變且唯讀的。 |
One |
表示數字一 (1)。 |
Zero |
表示數字零 (0)。 |
屬性
Scale |
取得小數的縮放比例,這是從 0 到 28 的數位,代表十進位數的數目。 |
方法
運算子
明確介面實作
適用於
執行緒安全性
此類型的所有成員都是安全線程。 看似修改實例狀態的成員,實際上會傳回以新值初始化的新實例。 如同任何其他類型,讀取和寫入包含此類型實例的共用變數必須受到鎖定保護,以確保線程安全。
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應