c# - Copy a class to another? -


i have

class {     public int a;     public string b; } 

how can copy a? in c++ know *a1 = *a2;. there similar in c#? know write generic solution using reflection hope exist already.

i'm considering changing a nullable struct.

step 2 i'll need do

class b : {} class c : {} 

and copy base data b c.

i have used binary serialization. basically, serialize instance memory stream. then, deserialize out of memory stream. have exact binary copy. deep copy, rather shallow copy.

class = new classa();  class b = myserializationmethod(a); 

for shallow copy can use object.memberwiseclone


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -