Monday, May 11, 2009

Conditional Mystery

Imagine a C# function like so:

public object Foobar(double baz_)
{
return baz_ < 12 ? new Foo(baz_) : baz_;
}

where Foo has a function as such:

public static implicit operator Foo(double d_)
{
return new Foo(d_);
}

What is the type of Foobar(2)? Foobar(15)? The shocking answer revealed whenever I get around to blogging next. Yes this was causing an outage in production.

No comments:

Post a Comment