What's the difference between struct and class in .NET?

前端 未结 19 1404
一向
一向 2020-11-22 01:51

What\'s the difference between struct and class in .NET?

相关标签:
19条回答
  • 2020-11-22 02:19

    Well, for starters, a struct is passed by value rather than by reference. Structs are good for relatively simple data structures, while classes have a lot more flexibility from an architectural point of view via polymorphism and inheritance.

    Others can probably give you more detail than I, but I use structs when the structure that I am going for is simple.

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