Can I specify a meaningful name for an anonymous class in C#?

后端 未结 10 1737
小蘑菇
小蘑菇 2021-02-01 13:12

We all know that when we create an anonymous class like this:

var Employee = new { ID = 5, Name= \"Prashant\" };

...at run time it will be of t

10条回答
  •  盖世英雄少女心
    2021-02-01 14:17

    I think that, by definition, Anonymous Types can't have a name, just that which the compiler gives it. If you're looking for more meaningful design-time information on Anonymous Types then you're expecting too much from the compiler.

提交回复
热议问题