Closed DotNetNext closed 2 months ago
I'm not clear on what you're proposing. The title of the issue includes "optimization"... what is that referring to? Are you instead suggesting a new syntax to create named types without declaring them?
Anonymous types are artifacts of compilers. The runtime has no concept of it. This should be a discussion to csharplang repo.
I'm not clear on what you're proposing. The title of the issue includes "optimization"... what is that referring to? Are you instead suggesting a new syntax to create named types without declaring them?
I wish there were new syntax to make anonymous types easier to use
This is the simplest application scenario, and there are many, many more
var list = db.Orders
.Select(it => new { Id = 1,Name=o.Name, CustomName = cus.Name })
.ToList();
//error
list.Add(new { Id = 1,Name=”a“, CustomName = "aa" })
Anonymous types are artifacts of compilers. The runtime has no concept of it. This should be a discussion to csharplang repo.
Maybe I sent it to the wrong place, but I just wanted to pass on the idea
Anonymous classes have no way to reuse the effect is very discounted
The name simply identifies them as the same type, so that it can be repeated