Say for example that I create a Duck
Duck myDuck = DuckFactory.CreateDuck();
In the past I've always check to see if myDuck is null
if (myDuck == null)
{
// Do stuff
}
I've recently looked at some code that check for null first.
if (null == myDuck)
{
// Do stuff
}
It seems to me that these are the same, but are there any differences between these two? Is there any performance benefits to one over the other? Is there a recommended best practice for checking if an object is null?