What is the Double.MaxValue in C#?

Overview

The Double.MaxValue in C# is a Double field that represents the largest possible value of Double. It is constant and read-only. This means it cannot be changed.

Syntax

public const double MaxValue = 1.7976931348623157E+308;
Syntax to get highest value of Double

Parameters

None. It is only invoked on the Double object.

Return value

The field Double.MaxValue returns the value 1.7976931348623157E+308.

Code example

// use System
using System;
// create class
class DoubleMaxValue
{
// main method
static void Main()
{
// print the field value
Console.WriteLine(Double.MaxValue);
// perform arithmetic operations
double d1 = Double.MaxValue + 323.323;
// print results
Console.WriteLine(d1);
}
}

Explanation

  • Line 11: We print the value of the Double.MaxValue field to the console.
  • Line 13: We perform some arithmetic operations with the field.
  • Line 16: We print the results.

As we can see, the results for the double variable are not greater than the Double.MaxValue field.

Free Resources