Extension methods with . operator always called, even if object is null without throwing NullReferenceException. By using operator ?. it will never called. For example:
using System;
public class Program
{
public static void Main()
{
A a = null;
a.b(); // works
a?.b(); // doesn't work
}
}
public class A { }
public static class ext
{
public static void b(this A a)
{
Console.WriteLine("I'm called");
}
}
Why extension method isn't called in this case? Is this an ambiguos feature?