EFileTahi-A
Contributor
But from a class that is inside another class.
This gives me an error saying that the class c_kaprical.c_solarSystem is not refered as Serializable. I've tried to tag c_solarSystem also with [Serializable]
This works well for c_kaprical class but for c_kaprical.c_solarSystem...
Any suggestions? I would love to keep this structure without removing the sub-classes from the main class. I just want to perform a deep copy of a given class despite of its method!
Thanks
Code:
[Serializable]
public class c_kaprical
{
//my objects
[COLOR="Red"] [Serializable] //<- this does not help.[/COLOR]
public class c_solarSystem
{
//my objects
public class c_kaprical.c_solarSystem Clone(c_kaprical.c_solarSystem newClone)
{
MemoryStream m = new MemoryStream();
BinaryFormatter b = new BinaryFormatter();
b.Serialize(m, newClone);
m.Position = 0;
return (c_kaprical.c_solarSystem)b.Deserialize(m);
}
}
}
This gives me an error saying that the class c_kaprical.c_solarSystem is not refered as Serializable. I've tried to tag c_solarSystem also with [Serializable]
This works well for c_kaprical class but for c_kaprical.c_solarSystem...
Any suggestions? I would love to keep this structure without removing the sub-classes from the main class. I just want to perform a deep copy of a given class despite of its method!
Thanks
Last edited: