Double - Cos
Returns the cosine of the specified angle.
public static void Main() { double[] doubles = { 0, 45, 90, 180 }; foreach (double value in doubles) { double radians = (value * (Math.PI)) / 180; // C# Extension Method: Double - Cos Console.WriteLine("Cos({0}) = {1}", value, radians.Cos()); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns the cosine of the specified angle. /// </summary> /// <param name="d">An angle, measured in radians.</param> /// <returns>The cosine of . If is equal to , , or , this method returns .</returns> public static Double Cos(this Double d) { return Math.Cos(d); } }