IsOdd
Checks whether a number is odd
Source
public static bool IsOdd(this int value)
{
return value % 2 != 0;
}
Example
int number = 1;
bool isOdd = number.IsOdd(); // true
int number = 2;
bool isOdd = number.IsOdd(); // false
ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods
Checks whether a number is odd
public static bool IsOdd(this int value)
{
return value % 2 != 0;
}
int number = 1;
bool isOdd = number.IsOdd(); // true
int number = 2;
bool isOdd = number.IsOdd(); // false