System.Nullable<T>.HasValue Property

Gets a value indicating whether the current Nullable`1 object has a valid value of its underlying type.

Syntax

public bool HasValue { get; }

Value

true if the current instance contains a value; otherwise false.

Remarks

If the Nullable`1.HasValue property is true, the value of the current Nullable`1 object can be accessed with the Nullable`1.Value property. Otherwise, attempting to access its value throws an InvalidOperationException exception.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0