use MORE structs?

前端 未结 3 1705
心在旅途
心在旅途 2021-01-20 00:57

There have been several questions over the past few days about the proper use of null; here are three (one is mine):

  • Best Practice: Should functions r
3条回答
  •  一生所求
    2021-01-20 01:51

    If you start using structs in weakly types scenarios (like assigning to an object type) Object o = structValue; or Object o = new mystruct(); or Object o = default(mystruct); etc. the values are boxed onto the heap, and they are also unboxed when used. This is a potential drawback because it affects performance. See info from Microsoft about boxing and unboxing.

提交回复
热议问题