C# Reference type assignment VS value type assignment

后端 未结 6 1385
自闭症患者
自闭症患者 2020-12-06 22:27

I understand the theoretical concept that assigning one reference type variable to another, only the reference is copied, not the object. assigning one value type variable t

6条回答
  •  一向
    一向 (楼主)
    2020-12-06 23:16

    One is a structure and the other is a class. This seems like an overly complicated example involving more than just value and reference differences but the differences between classes and structs as well.

    When one struct is assigned to another a copy is made.
    When one class is assigned to another only the reference changes.

提交回复
热议问题