given this class definition:
public class Foo {
public void Bar(string x) {
Console.WriteLine("string x was called");
}
public void Bar(int? x) {
Console.WriteLine("int? x was called");
}
}
what will be output to the console with the following code:
Foo f = new Foo();
try {
f.Bar(null);
}
catch {
Console.WriteLine("no method was called");
}
*update: I messed up the code while trying to upload another post, I recovered the original post from my RSS feed
1 comment:
I just couldn't believe this would compile, so I had to check. Luckily my first hunch was right. :-)
Post a Comment