Aug 7, 2015

Overload resolution in C#

After a long dark period of silence I am back :)

This time a little quiz.

Given the following C# program, what you expect to get printed?

using static System.Console;

class Foo 
 public void Bar(string[] o) { WriteLine("string[]"); } 
 public void Bar(object o) { WriteLine("object"); } 

 static void Main()
  var foo = new Foo();

Answers (if any), in comments ;)

Have fun!

Leia este post em Português!

No comments: