The exception that is thrown when there is an attempt to dereference a null object reference.
For a list of all members of this type, see NullReferenceException Members.
System.Object
System.Exception
System.SystemException
System.NullReferenceException
[Visual Basic] <Serializable> Public Class NullReferenceException Inherits SystemException [C#] [Serializable] public class NullReferenceException : SystemException [C++] [Serializable] public __gc class NullReferenceException : public SystemException [JScript] public Serializable class NullReferenceException extends SystemException
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.
Note that applications throw the ArgumentNullException exception rather than the NullReferenceException exception discussed here.
The following Microsoft intermediate language (MSIL) instructions throw NullReferenceException:
NullReferenceException uses the HRESULT COR_E_NULLREFERENCE, which has the value 0x80004003.
For a list of initial property values for an instance of NullReferenceException, see the NullReferenceException constructors.
Namespace: System
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET
Assembly: Mscorlib (in Mscorlib.dll)
NullReferenceException Members | System Namespace | Exception |