onez

onez

  • NA
  • 73
  • 0

Overloading Equals NullReferenceException

Jan 15 2005 2:01 PM
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; }

Answers (3)