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.000 0000-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 2 3087
Hello
ToString will do the job. but just make sure you use the InvariantCultur e
when serializing and deserializing.
Best regards,
Sherif
"Earl Teigrob" <ea******@hotma il.com> wrote in message
news:ea******** ******@tk2msftn gp13.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.000 0000-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
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.NO SPAM> wrote in message
news:uo******** ******@TK2MSFTN GP10.phx.gbl... Hello
ToString will do the job. but just make sure you use the InvariantCultur e when serializing and deserializing.
Best regards, Sherif
"Earl Teigrob" <ea******@hotma il.com> wrote in message news:ea******** ******@tk2msftn gp13.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.000 0000-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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Vottero |
last post by:
When a class contains a TimeSpan property, XmlSerializer doesn't work. A
TimeSpan property is serialized like:
<MySpan />
I've read a number of posts that talk about why this happens and how to work
around it. My question is from a slightly different angle. What can I do
to my value type structures so that XmlSerializer can serialize...
|
by: John |
last post by:
If a value type is immutable, I guess it's threadsafe to read it? But not
threadsafe to assign a new value to it (can any value type be truely
immutable? Isn't assigning a totally new value to it, like doing an
modification, when no references are involved? I don't know enough about
CLR)
At the moment the whole:
lock(anobject)
{
|
by: Zach |
last post by:
When it is being said that, "value types are created on the stack or inline as part of an
object". If a value type is created in an object, and that object is being
called, the value type in that object, is still created on the stack, I
would say, so I don't understand this inline business. Apart from the fact
that it is my understanding...
|
by: stephan querengaesser |
last post by:
hi ng,
i try to invoke a webservice-method with an filter-object, that
contains value types. if i don´t want to filter the return value of
the method, i have to pass a new instance of the filter-object without
setting any properties. but the value type-properties can´t be null
and the filter is set to 0 (int) or false (bool).
therefore i...
|
by: Sathyaish |
last post by:
Structs are value types, strings are ref types. If you have something
like this:
struct foo
{
System.String str;
}
foo TheDayToday;
| |
by: Craig Buchanan |
last post by:
i am trying to build an application that uses plugins to extend the business
functionality of an application. i've decided to use inheritance of
abstract classes as the mechanism to do this. moreover, i'm using a factory
pattern to control the creation of these classes (see full code below).
i'm having a bit of difficulty getting the...
|
by: Edward Diener |
last post by:
Given
value class X
{
public:
// Not allowed: X():i(100000),s(10000) { }
// Allowed
void InitializeDefaults() { i = 100000; s = 10000; }
private:
int i;
|
by: thisis |
last post by:
Hi All,
I'm getting an error on my ASP page:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'StoreFileIntoField'
I assume - 99.5% - the error is generated because of worng value types,
I attemp to pass from my ASP/VBScript page to the VB/DLL function.
|
by: MasterGaurav \(www.edujini-labs.com\) |
last post by:
Hi,
I have a, probably very basic, query on value-types.
Why cannot I use the == operator directly for value-types (not primitive
types like int, float, double etc)? Why do I need to either have an implicit
operator (to type-cast to primitive type) or override/overlaod the ==
operator myself?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |