Tuesday, August 18, 2009

Name resolution in optional parameter initializers

How do you think, what is the meaning of each T in the following C# 4.0 program? Will this code compile?


class A
{
public class T
{
public const int X = 1;
}

public void Foo<T>(int x = T.X, T y = default(T))
{
}
}

I will give the explanation in the next post.

1 comments:

NN​ said...

We are waiting for explanation :)