G
Guest
Hi,
while investigating the Framework dlls via Reflector, I found this code :
System.Drawing.Graphics :
public void DrawImage(Image image, int x, int y)
{
if (this == null)
throw new ArgumentNullException("this");
...
}
I was thinking of a mistake because from an OO aspect of view, I cannot
consider "this" to be ever null. It's inconceivable to call an instance
method of an instance that does not exist !
But I have just found another case :
System.AppDomain :
public ObjectHandle CreateInstance(string assemblyName, string typeName)
{
if (this == null)
throw new NullReferenceException();
...
}
So, am I miss something ?
while investigating the Framework dlls via Reflector, I found this code :
System.Drawing.Graphics :
public void DrawImage(Image image, int x, int y)
{
if (this == null)
throw new ArgumentNullException("this");
...
}
I was thinking of a mistake because from an OO aspect of view, I cannot
consider "this" to be ever null. It's inconceivable to call an instance
method of an instance that does not exist !
But I have just found another case :
System.AppDomain :
public ObjectHandle CreateInstance(string assemblyName, string typeName)
{
if (this == null)
throw new NullReferenceException();
...
}
So, am I miss something ?