You have two options and either can be shallow (references are copied) or deep
(data is copied):
public class MyForm : Form
{
1. Method
/// <summary>Creates a shallow copy of the instance.</summary>
public MyForm Copy()
{
return (MyForm) MemberwiseClone();
}
(You can implement ICloneable instead of using a custom method like Copy,
however I prefer the Copy method)
2. Constructor (preferred for deep copy, IMO, but can do both)
/// <summary>Constructs a new deep copy.</summary>
public MyForm(MyForm sourceToCopy)
{
if (sourceToCopy == null)
throw new ArgumentNullException("sourceToCopy");
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.