Ho to serialize a class into a byte array and vice versa?

  • Thread starter Thread starter Ole
  • Start date Start date
O

Ole

I have a class that I wish to convert into a byte array for sending over a
serial line and vice versa - how do I do that?

Thanks and regards
Ole
 
Search for BinarySerializer, XmlSerializer, DataContractSerializer, etc.
Or use something more obscure like "protocol buffers" ;-p

Each serializer has different use-cases, features and limitations. Note
that not all types can be serialized; your class must typically declare
that it is suitable for serialization (for example, via [Serializable]).

Marc
 
BinarySerializer sounds fine but unfortunately I can't find anything in the
C# documentation that mention such a serializer - please clarify to me.

Thanks
Ole
 
aw - the binaryformatters aren't supported in compact Framework for which
I'm writting my application. Therefore I now have posted my question in the
compact framework group.

BR
Ole
 
Back
Top