C# Класс Redzen.Structures.Compact.FixedPointDecimal

A fixed point decimal data type that has the following qualities: 1) Uses a Int32 to hold the value (4 bytes versus the native decimal's 16 bytes). 2) Defines a fixed number of six digits after the decimal place. 3) Allows a null value to be represented, requiring a single bit to allocated for this. The range of FixedPointDecimal is -1,073.741823 to 1,073.741823. This can therefore represent all possible values in the SQL data type decimal(9,6). The range takes into into account the null bit and the fixed four digits after the decimal place. Fixed point maths also has the benefit of allowing for far simpler/faster comparison.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Null FixedPointDecimal

Открытые методы

Метод Описание
Compare ( FixedPointDecimal d1, FixedPointDecimal d2 ) : int

Compares two specified FixedPointDecimal values.

Create ( decimal d ) : FixedPointDecimal

Static factory method to create a FixedDecimal.

Equals ( FixedPointDecimal d1, FixedPointDecimal d2 ) : bool

Determines whether the specified FixedPointDecimal is equal to the current FixedPointDecimal.

Equals ( object value ) : bool

Determines whether the specified Object is equal to the current Object.

FixedPointDecimal ( decimal val ) : System

Construct FixedPointDecimal from the provided nullable decimal.

GetHashCode ( ) : int

Gets the hash code for the object.

TryParse ( string s, FixedPointDecimal &result ) : bool

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed.

TryParseTruncate ( string s, FixedPointDecimal &result ) : bool

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed. Values outside the range of a FixedPointDecimal are truncated to the min or max values for FixedPointDecimal as appropriate. Input values with more than four decimal places have their precision truncated to to four decimal places.

operator ( ) : bool

Determines if two FixedPointDecimal objects are not equal.

Приватные методы

Метод Описание
FixedPointDecimal ( uint significand, bool isNegative ) : System
InternalTryParse ( string s, FixedPointDecimal &result, bool truncateRange ) : bool

Описание методов

Compare() публичный статический Метод

Compares two specified FixedPointDecimal values.
public static Compare ( FixedPointDecimal d1, FixedPointDecimal d2 ) : int
d1 FixedPointDecimal The first to compare.
d2 FixedPointDecimal The second to compare.
Результат int

Create() публичный статический Метод

Static factory method to create a FixedDecimal.
public static Create ( decimal d ) : FixedPointDecimal
d decimal The value to create the object from.
Результат FixedPointDecimal

Equals() публичный статический Метод

Determines whether the specified FixedPointDecimal is equal to the current FixedPointDecimal.
public static Equals ( FixedPointDecimal d1, FixedPointDecimal d2 ) : bool
d1 FixedPointDecimal The first to compare.
d2 FixedPointDecimal The second to compare.
Результат bool

Equals() публичный Метод

Determines whether the specified Object is equal to the current Object.
public Equals ( object value ) : bool
value object The object to compare with the current object.
Результат bool

FixedPointDecimal() публичный Метод

Construct FixedPointDecimal from the provided nullable decimal.
public FixedPointDecimal ( decimal val ) : System
val decimal The value to convert.
Результат System

GetHashCode() публичный Метод

Gets the hash code for the object.
public GetHashCode ( ) : int
Результат int

TryParse() публичный статический Метод

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed.
public static TryParse ( string s, FixedPointDecimal &result ) : bool
s string The value to parse.
result FixedPointDecimal Upon success contains the equivalent of the value of .
Результат bool

TryParseTruncate() публичный статический Метод

Converts the string representation of a number to its FixedPointDecimal equivalent. A return value indicates whether the conversion succeeded or failed. Values outside the range of a FixedPointDecimal are truncated to the min or max values for FixedPointDecimal as appropriate. Input values with more than four decimal places have their precision truncated to to four decimal places.
public static TryParseTruncate ( string s, FixedPointDecimal &result ) : bool
s string The value to parse.
result FixedPointDecimal Upon success contains the equivalent of the value of .
Результат bool

operator() публичный статический Метод

Determines if two FixedPointDecimal objects are not equal.
public static operator ( ) : bool
Результат bool

Описание свойств

Null публичное статическое свойство

Public static instance of a null FixedPointDecimal.
public static FixedPointDecimal,Redzen.Structures.Compact Null
Результат FixedPointDecimal