Maybe Extension

Coordinator
Nov 5, 2008 at 12:13 AM
Edited Nov 5, 2008 at 12:22 AM
The Maybe extension method has recently been added and it extends object directly. Should it extend ExtensionPoint<T> instead?

Given:
{code:c#}
  public class Foo
  {
    public void Do() {}
  }
{code:c#}

Should we have:
{code:c#}
  Foo foo = new Foo();
  foo.Maybe(x => x.Do());
  foo = null;
  foo.Maybe(x => x.Do());
{code:c#}

or

{code:c#}
  Foo foo = new Foo();
  foo.Extensions().Maybe(x => x.Do());
  foo = null;
  foo.Extensions().Maybe(x => x.Do());
{code:c#}

I'd rather see the latter as it isn't "polluating" every type with a Maybe extension...