Why is it possible to instantiate a struct without the new keyword?

前端 未结 7 1797
夕颜
夕颜 2020-12-07 15:29

Why are we not forced to instantiate a struct, like when using a class?

相关标签:
7条回答
  • 2020-12-07 15:53

    Because structs are value types and classes are reference types. So structs fall into the same category as int, double etc.

    0 讨论(0)
提交回复
热议问题