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

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

    Yes, you are creating an Anonymous Class , if you want your class to have a name, i.e. Not Anonymous, then declare a regular class or struct.

提交回复
热议问题