CSharp examples for System:Math Number
Find out whether the provided 64 bit integer is an even number.
// Crystal AI is free software: you can redistribute it and/or modify using System;//from www .j a v a 2 s .c om public class Main{ /// <summary> /// Find out whether the provided 64 bit integer is an even number. /// </summary> /// <param name="number">The number to very whether it's even.</param> /// <returns>True if and only if it is an even number.</returns> public static bool IsEven(this long number) { return (number & 0x1) == 0x0; } /// <summary> /// Find out whether the provided 32 bit integer is an even number. /// </summary> /// <param name="number">The number to very whether it's even.</param> /// <returns>True if and only if it is an even number.</returns> public static bool IsEven(this int number) { return (number & 0x1) == 0x0; } }