.NET: Are Dictionary values stored by reference or value

前端 未结 4 502
我在风中等你
我在风中等你 2021-02-07 02:14

I have a Dictionary. If the same Product is added to more than one key is an new instance of that object stored for each key? Or just a refere

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 02:50

    No, it should use the same reference to the original object.

    I'm not entirely certain how it will behave if the Dictionary is serialized/deserialized, however.

提交回复
热议问题