Why can\'t I initialize readonly variables in a initializer? The following doesn\'t work as it should:
class Foo { public readonly int bar; } new Foo {
What you're trying to do is this:
class Foo { public readonly int bar; Foo(int b) { bar = b; // readonly assignments only in constructor } } Foo x = new Foo(0);