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

后端 未结 10 1762
小蘑菇
小蘑菇 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 13:57

    Since it's anonymous, you cannot name it. If you need to know the name of a type, then you must really create a class.

提交回复
热议问题