Mono Class Library: System.Nullable<T> Overview | Members

System.Nullable<T>.HasValue Property

Indicates whether the current instance contains a value. [Edit]

public bool HasValue { get; }

Value

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

Remarks

Operation

If Nullable<T>.HasValue is true, the instance contains a value, and Nullable<T>.Value returns that value.

If Nullable<T>.HasValue is false, the instance contains no value, and an attempt to read Nullable<T>.Value results in a InvalidOperationExceptionexception. A call to Nullable<T>.Value.GetValueOrDefault returns the default value.

This property is read-only.

[Edit]

Requirements

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