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 Systemusing System;// create classclass DoubleMaxValue{// main methodstatic void Main(){// print the field valueConsole.WriteLine(Double.MaxValue);// perform arithmetic operationsdouble d1 = Double.MaxValue + 323.323;// print resultsConsole.WriteLine(d1);}}
Explanation
- Line 11: We print the value of the
Double.MaxValuefield 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.