I wanted to create a more constrained version of MemberwiseClone
, but realised the only way my own C# code can add properties to an object is to use dynamic
, but that can't give the object the same type as the original. My other, uglier choice is to emit source for the new clone and compile it during runtime, but that carries complexities re. assembly references etc. that I do not care for in keeping things simple.
For now I'm just using MemberwiseClone
, but am really curious as to how it works. I can't find any decompiled source.
Aucun commentaire:
Enregistrer un commentaire