In C#, use of value types vs. reference types

后端 未结 5 1246
醉话见心
醉话见心 2020-12-11 02:22

My questions are:

  • When should we use value types and when reference types?
  • What are the advantages and disadvantages of one over other?
  • What
5条回答
  •  生来不讨喜
    2020-12-11 02:51

    Use value types for immutables that do not have an identity of their own (a 1 is a 1), use reference types for other things.

提交回复
热议问题