INullableValue

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
Exam Prep. Guides
Exam 70-536 Study Guide

1. Types and collections

2. Process, threading,…
3. Embedding features
4. Serialization, I/O
5. .NET Security
6. Interop., reflection,…
7. Global., drawing, text

edit

Contents


The System.INullableValue interface defines the fundamental value and existence properties for nullable types. However, it has been removed from .NET 2.0; because, nullables are now an intrinsic type in the CLR.


Syntax

Declaration syntax

[ComVisibleAttribute(true)] 
public interface INullableValue

Method syntax

The INullableValue interface defines the following methods:

  • The HasValue method indicates whether a nullable type has a defined value.
bool HasValue { get; }
  • The Value method gets the value of the nullable type.
Object Value { get; }


INullableValue work around

Instead, code like the following may be used:

if (t.IsGenericType() && 
   (t.GetGenericTypeDefinition() 
      == typeof(System.Nullable<>))
{ }

Personal tools