During my C# class of today I noticed something strange with the C# compiler. Take the following piece of code:
public class Test
{
public Test()
: this(“Test”)
{
}
public Test(string someParam)
: this()
{
}
}
This actually compiles! I believe the C# 1.1 compiler checked for circular initializer lists like you see above, the 2.0 compiler doesn’t however.
No biggy, when you write this kind of code, you belong on the daily WTF anyway :)