THANK YOU!!!!!
That was it. My code looked like this:
public static bool operator ==(Mil pLeft, Mil pRight)
{
if (null != (object)pLeft && null != (object)pRight)
return pLeft.IsCode(pRight);
return false;
}
I added the following and it works as expected now:
if (null == (object)pLeft && null == (object)pRight)
return true;
I've been pulling my hair out for hours. Dumb mistake on my part. I
totally forgot I overloaded that in the base class. I know I was doing
something wrong somewhere. Good call Michael.
Thanks again,
Jim
"Michael C" <no****@nospam.comwrote in message
news:e2**************@TK2MSFTNGP03.phx.gbl...
does DBMil have == overloaded?
"Jim H" <ji**@nospam.nospamwrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...
>Pid.DBMil lMil = null;
if (null == lMil)
System.Diagnostics.Trace.WriteLine("\r\nIt was NULL\r\n"); //-- this
never prints
That diag line never prints.
later on in a loop I do this:
for (int i = 0; i < liLoopCount; i++)
{
if(lMil == null)
lMil = new Pid.DBMil();
lMilCode.GetData(i); //--Causes a null refernce exception
//more code here
}
How do you check to see if a variable is referencing null?
Thanks in advance,
jim