System.INullableValue Interface

public interface INullableValue

Assembly

mscorlib

Library

BCL

Summary

Supported by types that either have a value or an indication of the absence of a value.

Description

An object that supports the INullableValue interface can be tested via the property System.INullableValue.HasValue to see if that object currently contains a value. If it does, that value can be retrieved via the property System.INullableValue.Value. Otherwise, that object contains no value.

See Also

System Namespace

Members

INullableValue Properties

INullableValue.HasValue Property
INullableValue.Value Property


INullableValue.HasValue Property

bool HasValue { get; }

Summary

Indicates whether the current instance contains a value.

Property Value

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

Description

[Behaviors: If System.INullableValue.HasValue is true , the instance contains a value, and System.INullableValue.Value returns that value.

If System.INullableValue.HasValue is false , the instance contains no value, and an attempt to read System.INullableValue.Value results in a InvalidOperationException.

This property is read-only.

]

See Also

System.INullableValue Interface, System Namespace

INullableValue.Value Property

object Value { get; }

Summary

Gets the value, if any, of the current instance.

Property Value

The value of the current instance.

Exceptions

Exception TypeCondition
System.InvalidOperationExceptionSystem.INullableValue.HasValue is false .

Description

[Behaviors: If System.INullableValue.HasValue is true , the instance contains a value, and System.INullableValue.Value returns that value.

If System.INullableValue.HasValue is false , the instance contains no value, and an attempt to read System.INullableValue.Value results in a InvalidOperationException.

This property is read-only.

]

See Also

System.INullableValue Interface, System Namespace