Determines whether the specified value is an odd number. - CSharp System

CSharp examples for System:Math Number

Description

Determines whether the specified value is an odd number.

Demo Code


using System.Text.RegularExpressions;
using System.Security.Cryptography;
using System.Globalization;
using System;/*from   w w  w . ja va2s. c  o  m*/

public class Main{
        /// <summary>
        /// Determines whether the specified value is an odd number.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns>
        ///    <c>true</c> if the specified value is odd; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsOdd(this int value)
        {
            return ((value & 1) == 1);
        }
}

Related Tutorials