http://www.codeproject.com/useritems/0g_GenericsAndCloning.asp
It's not perfect.. as some of the comments say, but would work well for what I'm doing except I cannot do this because I do not believe the CF supports that type of serialization.
Here's what I have.. (specific class structure shown below)
Class A - base class
Class B : Class A
ClassB1 : ClassB
ClassB2:ClassB
Class C : Class AClassB2:ClassB
ClassC2:ClassC
ClassC3:ClassC
//possibly others
ClassC3:ClassC
//possibly others
Now.. I need a way to perform a deep copy on all of the final classes. Would be nice to have it in the parent class and could do it in some general way..
Or.. do I have to write a sperate clone method in each where I create a new object of the same type and copy over the data manually
More specifically my classes have this type of information
DataFormat
FontFormat : DataFormat
OutlinedFont : FontFormat
BitmapFont : FontFomart
BarcodeFormat : DataFormatBitmapFont : FontFomart
Code39 : BarcodeFormat
Interleave2of5 : BarcodeFormat
Interleave2of5 : BarcodeFormat
Basically I'm writing a library for an old barcode printer. I want to be able to create a "TagFormat" and add these formatting objects (which contain position and formatting information) to collection in it.. then the format will call CreateTag which should return a Tag with the formatting information with it (The formats will have no value for what to print yet). Then I need to actually fill in the String values for the formats without affecting the original format itself. The tag itself hides the formatting information from the user, it just allows for the fields to be filled, but the printer itself needs that infomation so it needs to be deep copied so that changing 1 tag doesn't affect all.
Question is.. what is the best way to do it in this case

How to perform deep copy in this case?
Anonymous Hacker
MonicaMaloney
However.. if anyone wants to post a good example of how to do it feel free.