Summary
It doesn't seem to be possible to use if (myArray == null) to check whether myArray is null, if it has been initialized to NDArray myArray = null;. This is because the == operator has been overridden without any additional checks.
Minimal example of bug
static void Main(string[] args)
{
NDArray myArray = null;
if (myArray == null) // NullReferenceException is thrown here
{
Debug.WriteLine("myArray is null");
}
}
Expected behaviour
myArray == null should return true, not throw a NullReferenceException.
Summary
It doesn't seem to be possible to use
if (myArray == null)to check whether myArray is null, if it has been initialized toNDArray myArray = null;. This is because the == operator has been overridden without any additional checks.Minimal example of bug
Expected behaviour
myArray == nullshould return true, not throw a NullReferenceException.