title: C# Compiler Related Object reference not set to an instance of an object
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5257626/is-there-a-reason-why-nullreferenceexception-does-not-give-the-name-of-the-varia">Is there a reason why NullReferenceException does not give the name of the variable?</a>  </p>
  </blockquote>
  
  
  
  <p>Why Even higher level languages like C# or Java couldnt easily provide a mechanism to find which object type and instance (variable) is null? Should we need to write a custom logic for the same.</p>
  
  <pre><code> ex:   SampleClass sc = null;
         sc.SomeMethod();
  </code></pre>
  
  <p>I would like to say "Object sc of type SampleClass is null" rather than a naive exception message "Object reference not set to an instance of an object."</p>