Ignacio Machin ( .NET/ C# MVP ) wrote:
}{ wrote:
I have implemented a class that contains two Serial port objects
among other things. When I try to serialize this class I get an
error relating to the fact that Serial Port class isn't marked as
serializable.
Is it possible to accomplish this.
Any help is greatly appreciated.
look at [Serializable] attribute
to make clas serializable
[Serializable]
public class YourClass
{
}
I did this, but I think the error relates specifically to the fact
that my class contains other classes that aren't serializable. It is
only a guess though because I'm not too familiar with C#.
I will get out my laptop later and post some code and the error
received if it helps.
Thanks- Hide quoted text -
- Show quoted text -
Use a [NonSerialized] attribute for those members
I think a custom serialization function is needed, to serialize port number
or whatever needs to be saved, but more importantly to reopen ports when
deserializing.- Hide quoted text -
- Show quoted text -