In C#, an anonymous type can be as follows:
method doStuff(){ var myVar = new { a = false, b = true } if (myVar.a) {
You won't be able to get the nice initialization syntax but the ExpandoObject class introduced in .NET 4 would serve as a viable solution.
ExpandoObject
dynamic eo = new ExpandoObject(); eo.SomeIntValue = 5; eo.SomeIntValue = 10; // works fine