.Equals() fails when object is null

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		Object a = null;
		Object b = new Object();
		
		Console.WriteLine(a == b);
		Console.WriteLine(b == a);
		
		// null check works with roslyn compiler (C# 6), but not .net 4.5
		/*
		Console.WriteLine(b?.Equals(a));
		Console.WriteLine(a?.Equals(b));
		*/
		
		Console.WriteLine(b.Equals(a));	
		Console.WriteLine(a.Equals(b));
		
	}
}
;