copy a class, C#

后端 未结 12 1790
失恋的感觉
失恋的感觉 2020-12-03 10:13

Is there a way to copy a class in C#? Something like var dupe = MyClass(original).

12条回答
  •  南笙
    南笙 (楼主)
    2020-12-03 10:50

    One possibility is to clone it. You have to implement the interface ICloneable and the Clone method.

提交回复
热议问题