I can create an anonymous class easily using the below. However I can't write to it. Is there a way I can write to some sort of unnamed class?
var test = new { a = 5, b = "sz" };
test.a++;
I can create an anonymous class easily using the below. However I can't write to it. Is there a way I can write to some sort of unnamed class?
var test = new { a = 5, b = "sz" };
test.a++;
This is not possible with anonymous types because the properties of an anonymous class are read-only. As to why, you can read here: