Number Category
using DotToolkit.Extensions;
Return
Check if the number is NaN.
double value = doble.NaN;
var result = value.IsNaN()
// -> true
Return
Check if the number is NaN.
float value = float.NaN;
var result = value.IsNaN()
// -> true
Converts the specified value to an 8-bit unsigned integer byte
.
Return
The 8-bit unsigned integer representation of the value.
int value = 123;
byte result = value.ToByte();
//-> 123
Converts the specified value to an 8-bit signed integer sbyte
.
Return
The 8-bit signed integer representation of the value.
int value = -123;
sbyte result = value.ToSByte();
sbyte result = value.ToSByte();
//-> -123
Converts the specified value to a 16-bit signed integer short
.
Return
The 16-bit signed integer representation of the value.
int value = 12345;
short result = value.ToShort();
//-> 12345
Converts the specified value to a 16-bit unsigned integer ushort
.
Return
The 16-bit unsigned integer representation of the value.
int value = 12345;
ushort result = value.ToUShort();
//-> 12345
Converts the specified value to a 32-bit signed integer int
.
Return
The 32-bit signed integer representation of the value.
double value = 123.45;
int result = value.ToInt();
//-> 123
Converts the specified value to a 32-bit unsigned integer uint
.
Return
The 32-bit unsigned integer representation of the value.
double value = 123.45;
uint result = value.ToUInt();
//->123
Converts the specified value to a 64-bit signed integer long
.
Return
The 64-bit signed integer representation of the value.
int value = 12345;
long result = value.ToLong();
// -> 12345
Converts the specified value to a 64-bit unsigned integer ulong
.
Return
The 64-bit unsigned integer representation of the value.
int value = 12345;
ulong result = value.ToULong();
//-> 12345
Converts the specified value to a single-precision floating point number float
.
Return
The single-precision floating point representation of the value.
int value = 123;
float result = value.ToFloat();
//-> 123.0
Converts the specified value to a decimal number decimal
.
Return
The decimal number representation of the value.
double value = 123.45;
decimal result = value.ToDecimal();
//->123.45
Converts the specified value to a double-precision floating point number double
.
Return
The double-precision floating point representation of the value.
int value = 123;
double result = value.ToDouble();
//->123.0