[Mono-dev] Faster

Steve Lessard s_lessard at yahoo.com
Fri Mar 25 00:16:40 EDT 2011

I think Sebastian already touched on this issue, but I wanted to shine a
little more light on it.  If the Something class were defined as below and x
was not null wouldn't the Foo method throw an exception incorrectly stating
that x was null?

class Something 
    public Something()

    public void DoSomething()
        throw new NullReferenceException();

void Foo (Something x) 
    try { 
        x.DoSomething (); 
    } catch (NullReferenceException e){ 
        if (x == null) 
             throw new ArgumentNullException ("x"); 
    x.AndThenMore (); 

View this message in context: http://mono.1490590.n4.nabble.com/Faster-tp3402943p3404445.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

More information about the Mono-devel-list mailing list