[Mono-dev] Faster
Stifu
stifu at free.fr
Fri Mar 25 03:07:19 EDT 2011
Huh? I don't get it.
In the exception handling code, it checks if x is null, so it'd go to the
"throw;" part instead.
No reason it'd act as if x was null.
Steve Lessard wrote:
>
> 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");
> else
> throw;
> }
> x.AndThenMore ();
> }
>
--
View this message in context: http://mono.1490590.n4.nabble.com/Faster-tp3402943p3404661.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list