N
Neeraj
hi
I want to make clone of current Form which is currently seen.I Used
attribute [Serializable] above the class declaration which extends
Form. Impleament the ICloneable interface and Make method which code is
public Object Clone()
{
return this.MemberwiseClone();
}
public static object DeepClone(
object obj)
{
object clone = null;
using (MemoryStream ms =
new MemoryStream())
{
BinaryFormatter bf =
new BinaryFormatter();
bf.Serialize(ms, obj);
ms.Position = 0;
clone = bf.Deserialize(ms);
}
return clone ;
}
but it generate SerializationException
which i show
Type 'System.Windows.Forms.Form' in Assembly 'System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is
not marked as serializable.
At
bf.Serialize(ms, obj);
that Line.
any one have any idea regard this please share this.
with regards.
Neeraj
I want to make clone of current Form which is currently seen.I Used
attribute [Serializable] above the class declaration which extends
Form. Impleament the ICloneable interface and Make method which code is
public Object Clone()
{
return this.MemberwiseClone();
}
public static object DeepClone(
object obj)
{
object clone = null;
using (MemoryStream ms =
new MemoryStream())
{
BinaryFormatter bf =
new BinaryFormatter();
bf.Serialize(ms, obj);
ms.Position = 0;
clone = bf.Deserialize(ms);
}
return clone ;
}
but it generate SerializationException
which i show
Type 'System.Windows.Forms.Form' in Assembly 'System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is
not marked as serializable.
At
bf.Serialize(ms, obj);
that Line.
any one have any idea regard this please share this.
with regards.
Neeraj