“OverloadResolutionBasic” (Problem)
What will the following code display?
1
void Foo(object a)
2
{
3
Console.WriteLine("object");
4
}
5
void Foo(object a, object b)
6
{
7
Console.WriteLine("object, object");
8
}
9
void Foo(params object[] args)
10
{
11
Console.WriteLine("params object[]");
12
}
13
void Foo<T>(params T[] args)
14
{
15
Console.WriteLine("params T[]");
16
}
17
class Bar { }
18
void Main()
19
{
20
Foo();
21
Foo(null);
22
Foo(new Bar());
23
Foo(new Bar(), new Bar());
24
Foo(new Bar(), new object());
25
}
Copied!
Solution
Copy link