What is a NullReferenceException in .NET?
Posted
by
John Saunders
on Stack Overflow
See other posts from Stack Overflow
or by John Saunders
Published on 2011-01-11T16:48:29Z
Indexed on
2011/01/11
19:53 UTC
Read the original article
Hit count: 399
.NET
|nullreferenceexception
(I'm creating this separate question and answer because every question we get on NullReferenceException
is really the same)
I have some code and when it executes, it throws a NullReferenceException
, saying, "Object reference not set to an instance of an object.".
What does this mean, and what can I do about it?
Note again, that this is a question meant to focus answers to the canonical "what is a NullReferenceException
and why did I get one" question. I do know what a NullReferenceException
is, as my answer below demonstrates.
© Stack Overflow or respective owner