c# custom serialization

mmingfeilam
mmingfeilam used Ask the Experts™
on
is there a way to use a custom serializer to serialize an object into a comma delimited file, e.g. firstname, middilename, ...
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kyle AbrahamsSenior .Net Developer

Commented:
yes

http://msdn.microsoft.com/en-us/library/ty01x675(v=vs.80).aspx

Just create a class that implements I serializable.  

Then create a function Read() that returns your object using the sample above.

Author

Commented:
the example you mentioned doesn't go into specifics about how to serialize the object into a flat delimited string.  most of the example i saw always serialize to a binary format, i.e. data.dat.  thanks.
Senior .Net Developer
Commented:
Try this one:
http://msdn.microsoft.com/en-us/library/szzyf24s(v=vs.80)

This is for XML . . . but XML is technically text.


If you just wanted to do  a string,  create a Serialize Method within your class, adding the properties one at a time plus the delimiter.

Then you would split the delimiter for deserializing, assigning each property back.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial