public static class Extension { public static void Test(this DateTime? dt) { } } void Main() { var now = DateTime.Now; Extension.Test(now); //
Because you wrote an extension for DateTime? and not for DateTime.
DateTime?
DateTime
DateTime? now = DateTime.Now; Extension.Test(now); // ok now.Test(); // no compile time error
or
var now = new DateTime?(DateTime.Now); Extension.Test(now); // ok now.Test(); // no compile time error
will work.