Represents the exception that is thrown when there is an attempt to dereference a null object reference.
Object
Exception
SystemException
NullReferenceException
[Visual Basic] Public Class NullReferenceException Inherits SystemException [C#] public class NullReferenceException : SystemException [C++] public __gc class NullReferenceException : public SystemException [JScript] public class NullReferenceException extends SystemException
The NullReferenceException is the exception class that is thrown when the access reference to a null reference is changed.
Namespace: System
Assembly: mscorlib.dll
The following code would cause a NullReferenceException to be thrown:
#import <mscorlib.dll> #define NULL 0x00 void main() { Object *obj = NULL; obj->ToString(); }