Overloading Equals NullReferenceException
Values is a indexer class with a Int64 array. If I try to check if a value class is null it results in a null reference exception. Checks for null inside this method result in an infinite loop. How should I determine if a Values class is null?
public static bool operator ==(Values vals1, Values vals2)
{
bool ret = false;
for (int x = 0; x < vals1.Length; x++)
{
if (vals1[x] == vals2[x]) ret = true;
else return false;
}
return ret;
}
shimtannyPosted Jan 17, 2005, 5:47 AM
onezPosted Jan 16, 2005, 4:07 PM
shimtannyPosted Jan 16, 2005, 5:00 AM