C# Class Example.Utilities.Extensions.DecimalExtensions

Afficher le fichier Open project: feanz/Utilities

Méthodes publiques

Méthode Description
DigitAtPosition ( this number, int position ) : int

Method that finds a digit at an arbirary position of a decimal. The number. The position of the digit to the right of the decimal (1-n). Digit at position var number = 1.2459m; var digit = number.DigitAtPosition(3); // value is 5 See also http://stackoverflow.com/questions/2923510/what-is-the-best-way-to-find-the-digit-at-n-position-in-a-decimal-number/2924042#2924042.

EnsurePositive ( this number ) : decimal

Ensures that the specified decimal is positive

Private Methods

Méthode Description
SanitizedDigitAtPosition ( this sanitizedNumber, int validPosition ) : int

Method Details

DigitAtPosition() public static méthode

Method that finds a digit at an arbirary position of a decimal. The number. The position of the digit to the right of the decimal (1-n). Digit at position var number = 1.2459m; var digit = number.DigitAtPosition(3); // value is 5 See also http://stackoverflow.com/questions/2923510/what-is-the-best-way-to-find-the-digit-at-n-position-in-a-decimal-number/2924042#2924042.
public static DigitAtPosition ( this number, int position ) : int
number this
position int
Résultat int

EnsurePositive() public static méthode

Ensures that the specified decimal is positive
public static EnsurePositive ( this number ) : decimal
number this The decimal we are ensuring is positive.
Résultat decimal