Is it possible to define an array or list from an anonymous class?
like this:
persons = new ... [] { new { ID = 1, Name = "Name1"}, new { ID = 2, Name = "Name2"} }
Yes, you just need to enter the variable personsimplicitly and remove the type specifier from the array creation statement.
persons
var persons = new [] { new { ID = 1, Name = "Name1" }, new { ID = 2, Name = "Name2" } }
Source: https://habr.com/ru/post/1769010/More articles:How to quickly sort by multiple columns - sortingWhy can't I update our Twitter status? - phpTwitter oauth problem with frindship / create in api - objective-cIs it possible to disable symfony caching on request - cachingMany sets at different intervals (Mathematica) - functionOptimize a query that uses multiple left joins in the same tables - optimizationWhen creating an iOS application (Xcode), how can I turn off the automatic gelling icon, - iosautomake: change implicity make rule to include additional flags - makefileКак использовать команду и EventTrigger в ButtonTemplate Button? - commandActionScript 3 - Sprite Always On Top - actionscript-3All Articles