public static class MowingNad
public static R? AndThen<T, R>(this T? self, Func<T, R?> doThat)
if (self is {} something) {
return doThat.Invoke(something);
public static R? AndThen<T, R>(this T? self, Func<T, R?> doThat)
if (self is {} something) {
return doThat.Invoke(something);
static void Demo<T>(T? opt) {
var n = opt.AndThen<T, int>(s => 42);
var s2 = opt.AndThen<T, string>(s => "hey");
Console.WriteLine("}\n");
public static void Main()