By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,738 Members | 1,682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,738 IT Pros & Developers. It's quick & easy.

Serializing and Deserializing Value Types to String

P: n/a
I am saving and restoring value types such as Int32, DateTime and Boolean in
strings. I was wondering if there is a mechanism build into .NET for
serializing and deserializing these to string format. I can, of course,
serialize a class to a file, either binary or XML, but this is not what I am
looking for. Currently I am using ToString() or Convert.xxx to do this, but
thought that if there was a true serializer, deserializer, that would be
perfect.

An example would be the way that a DateTime column in a DataTable is
serialized to XML. It is converted to the format
"2004-04-30T19:30:00.0000000-05:00". Microsoft has built a special DateTime
serializer into there XML converter to save (and restore) DateTime in a
string (for XML) format. This saves the time with maximum precision,
relative to MGT.

Can I access to class to do something similar?

Thanks for you Input

Earl

Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello

ToString will do the job. but just make sure you use the InvariantCulture
when serializing and deserializing.

Best regards,
Sherif

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:ea**************@tk2msftngp13.phx.gbl...
I am saving and restoring value types such as Int32, DateTime and Boolean in strings. I was wondering if there is a mechanism build into .NET for
serializing and deserializing these to string format. I can, of course,
serialize a class to a file, either binary or XML, but this is not what I am looking for. Currently I am using ToString() or Convert.xxx to do this, but thought that if there was a true serializer, deserializer, that would be
perfect.

An example would be the way that a DateTime column in a DataTable is
serialized to XML. It is converted to the format
"2004-04-30T19:30:00.0000000-05:00". Microsoft has built a special DateTime serializer into there XML converter to save (and restore) DateTime in a
string (for XML) format. This saves the time with maximum precision,
relative to MGT.

Can I access to class to do something similar?

Thanks for you Input

Earl


Nov 16 '05 #2

P: n/a
Sherif,

I am very familiar with ToString... but I am looking for a way to serialize
that this made for deserializing and restoring the original value (As in the
DateTime example) without losing any precision...

Anyone know about a class for this???

Earl

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:uo**************@TK2MSFTNGP10.phx.gbl...
Hello

ToString will do the job. but just make sure you use the InvariantCulture
when serializing and deserializing.

Best regards,
Sherif

"Earl Teigrob" <ea******@hotmail.com> wrote in message
news:ea**************@tk2msftngp13.phx.gbl...
I am saving and restoring value types such as Int32, DateTime and
Boolean in
strings. I was wondering if there is a mechanism build into .NET for
serializing and deserializing these to string format. I can, of course,
serialize a class to a file, either binary or XML, but this is not what
I am
looking for. Currently I am using ToString() or Convert.xxx to do this,

but
thought that if there was a true serializer, deserializer, that would be
perfect.

An example would be the way that a DateTime column in a DataTable is
serialized to XML. It is converted to the format
"2004-04-30T19:30:00.0000000-05:00". Microsoft has built a special

DateTime
serializer into there XML converter to save (and restore) DateTime in a
string (for XML) format. This saves the time with maximum precision,
relative to MGT.

Can I access to class to do something similar?

Thanks for you Input

Earl



Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.