Maybe, inspired by Mark Seemann
public class Maybe<T> : IEnumerable<T>
{
readonly IEnumerable<T> values;
public Maybe()
{
values = new T[0];
}
public Maybe(T value)
{
values = new[] { value };
}
public IEnumerator<T> GetEnumerator()
{
return values.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}