NumberExtensions Class
Provides extension methods for numeric types.
public static class NumberExtensionsMethods
| Name | Description |
|---|---|
| MakeSameSignAs(decimal, decimal) | Returns the absolute value of number with the sign of sign. |
| MakeSameSignAs(double, double) | Returns the absolute value of number with the sign of sign. |
| MakeSameSignAs(int, int) | Returns the absolute value of number with the sign of sign. |
| MakeSameSignAs(long, long) | Returns the absolute value of number with the sign of sign. |
| MakeSameSignAs(float, float) | Returns the absolute value of number with the sign of sign. |
| ToEnglishOrdinal(int) | Converts an integer to its English ordinal representation (e.g., 1st, 2nd, 3rd). |
| ToEnglishOrdinal(int, IFormatProvider) | Converts an integer to its English ordinal representation using the specified format provider. |
| ToFrenchOrdinal(int) | Converts an integer to its French ordinal representation (e.g., 1er, 2e, 3e). |
| ToFrenchOrdinal(int, IFormatProvider) | Converts an integer to its French ordinal representation using the specified format provider. |
| ToStringInvariant(byte) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(byte, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(decimal) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(decimal, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(double) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(double, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(Half) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(Half, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(short) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(short, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(int) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(int, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(long) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(long, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(sbyte) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(sbyte, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(float) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(float, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(ushort) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(ushort, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(uint) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(uint, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
| ToStringInvariant(ulong) | Converts the number to its string representation using the invariant culture. |
| ToStringInvariant(ulong, string?) | Converts the number to its string representation using the invariant culture and the specified format. |
MakeSameSignAs overloads
MakeSameSignAs(decimal, decimal)
NumberExtensions.csMakeSameSignAs(double, double)
NumberExtensions.csMakeSameSignAs(int, int)
NumberExtensions.csReturns the absolute value of number with the sign of sign.
Parameters
Returns
Exceptions
OverflowExceptionnumberisInt32.MinValueandsignis positive or zero.
Remarks
A zero sign is positive.
MakeSameSignAs(long, long)
NumberExtensions.csReturns the absolute value of number with the sign of sign.
Parameters
Returns
Exceptions
OverflowExceptionnumberisInt64.MinValueandsignis positive or zero.
Remarks
A zero sign is positive.
MakeSameSignAs(float, float)
NumberExtensions.csToEnglishOrdinal overloads
ToEnglishOrdinal(int)
NumberExtensions.csToEnglishOrdinal(int, IFormatProvider)
NumberExtensions.csConverts an integer to its English ordinal representation using the specified format provider.
public static string ToEnglishOrdinal(int num, IFormatProvider formatProvider)ToFrenchOrdinal overloads
ToFrenchOrdinal(int)
NumberExtensions.csToFrenchOrdinal(int, IFormatProvider)
NumberExtensions.csConverts an integer to its French ordinal representation using the specified format provider.
public static string ToFrenchOrdinal(int num, IFormatProvider formatProvider)