.NET: Are Dictionary values stored by reference or value

前端 未结 4 507
我在风中等你
我在风中等你 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:57

    If Product is a reference type (class and not struct), only a reference will be stored.

提交回复
热议问题