Double - IsInfinity
Returns a value indicating whether the specified number evaluates to negative or positive infinity.
public static void Main() { Console.WriteLine("It returns a value indicating whether the specified number evaluates to negative or positive infinity.\n"); Display(32.0, 12); Display(32.0, 0.0); Display(-5, 0.0); Display(0.0, 0.0); } public static void Display(double d1, double d2) { // C# Extension Method: Double - IsInfinity bool result = (d1 / d2).IsInfinity(); Console.WriteLine("{0}/{1} = {2}", d1, d2, result); }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns a value indicating whether the specified number evaluates to negative or positive infinity. /// </summary> /// <param name="d">A double-precision floating-point number.</param> /// <returns>true if evaluates to or ; otherwise, false.</returns> public static Boolean IsInfinity(this Double d) { return Double.IsInfinity(d); } }