Hello,
I have a situation where I would like to perform custom serialization
and deserialization of an existing .NET framework object (specifically,
System.DateTime ). Is there a common paradigm here, for how I can
override the default behavior of DateTime serialization and provide my
own? I want to use this custom serialized DateTime in many places, and
don't want to provide custom serialization routines for every single
object that uses one of these DateTimes, it just seems easier to just
apply it directly to the DateTime object so that everywhere I use it,
it automatically picks up my new method.
The reason I'm doing this is because I'm doing .NET remoting with a 2.0
server and clients which might be either 1.1 or 2.0. I want the
serialization to behave correctly no matter what version the client is. 3 2627
I've already done a few tests on serializing between the two versions .net
(1.1 and 2.0) with good results (didn't test DateTime though). What exactly
is the difference between the two versions ?
Mike http://www.seeknsnatch.com
"Zachary Turner" <di***********@ gmail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Hello,
I have a situation where I would like to perform custom serialization
and deserialization of an existing .NET framework object (specifically,
System.DateTime ). Is there a common paradigm here, for how I can
override the default behavior of DateTime serialization and provide my
own? I want to use this custom serialized DateTime in many places, and
don't want to provide custom serialization routines for every single
object that uses one of these DateTimes, it just seems easier to just
apply it directly to the DateTime object so that everywhere I use it,
it automatically picks up my new method.
The reason I'm doing this is because I'm doing .NET remoting with a 2.0
server and clients which might be either 1.1 or 2.0. I want the
serialization to behave correctly no matter what version the client is.
The difference is in 2.0 DateTimes are serialized with one extra field.
A 2 bit (i think) value specifying whether the following serialized
time is Utc or Local time. When .NET 1.1 tries to deserialize this, it
obviously fails and throws an exception. As far as I know many objects
work successfully when serializing across versions, but DateTime seems
to be one of the exceptions to the rule.
Is there any way to override the default deserialization behavior for
the entire type?
Michael Klingensmith wrote:
I've already done a few tests on serializing between the two versions .net
(1.1 and 2.0) with good results (didn't test DateTime though). What exactly
is the difference between the two versions ?
Mike http://www.seeknsnatch.com
"Zachary Turner" <di***********@ gmail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
Hello,
I have a situation where I would like to perform custom serialization
and deserialization of an existing .NET framework object (specifically,
System.DateTime ). Is there a common paradigm here, for how I can
override the default behavior of DateTime serialization and provide my
own? I want to use this custom serialized DateTime in many places, and
don't want to provide custom serialization routines for every single
object that uses one of these DateTimes, it just seems easier to just
apply it directly to the DateTime object so that everywhere I use it,
it automatically picks up my new method.
The reason I'm doing this is because I'm doing .NET remoting with a 2.0
server and clients which might be either 1.1 or 2.0. I want the
serialization to behave correctly no matter what version the client is.
Hi Zachary,
Take a look at the following interfaces:
System.Runtime. Serialization.I SurrogateSelect or
System.Runtime. Serialization.I SerializationSu rrogate
They allow you to provide serialization and deserialization logic that replaces the default logic for any given Type.
SurrogateSelect or class on MSDN (has an example): http://msdn2.microsoft.com/en-us/lib...eselector.aspx
--
Dave Sexton
"Zachary Turner" <di***********@ gmail.comwrote in message news:11******** **************@ 74g2000cwt.goog legroups.com...
The difference is in 2.0 DateTimes are serialized with one extra field.
A 2 bit (i think) value specifying whether the following serialized
time is Utc or Local time. When .NET 1.1 tries to deserialize this, it
obviously fails and throws an exception. As far as I know many objects
work successfully when serializing across versions, but DateTime seems
to be one of the exceptions to the rule.
Is there any way to override the default deserialization behavior for
the entire type?
Michael Klingensmith wrote:
>I've already done a few tests on serializing between the two versions .net (1.1 and 2.0) with good results (didn't test DateTime though). What exactly is the difference between the two versions ?
Mike http://www.seeknsnatch.com
"Zachary Turner" <di***********@ gmail.comwrote in message news:11******* *************** @i3g2000cwc.goo glegroups.com.. .
Hello,
I have a situation where I would like to perform custom serialization
and deserialization of an existing .NET framework object (specifically,
System.DateTime ). Is there a common paradigm here, for how I can
override the default behavior of DateTime serialization and provide my
own? I want to use this custom serialized DateTime in many places, and
don't want to provide custom serialization routines for every single
object that uses one of these DateTimes, it just seems easier to just
apply it directly to the DateTime object so that everywhere I use it,
it automatically picks up my new method.
The reason I'm doing this is because I'm doing .NET remoting with a 2.0
server and clients which might be either 1.1 or 2.0. I want the
serialization to behave correctly no matter what version the client is. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: andrew lowe |
last post by:
Hi,
Please bear with me on this problem, first I'll give you some background:
I have an object that contains a DateTime field which i pass to a webservice
public class Foo {
public DateTime RequestDate;
}
|
by: big A |
last post by:
I am receiving an error stating that File or Assembly name
<filname.dll>, or one of its dependencies, was not found
In one assembly I have three abstract classes
In another I have three derived classes from the abstract classes
The 1st class contains the 2nd class
The 2nd class is a custom collection for the 3rd class
|
by: BjörnHolmberg |
last post by:
Hi everyone!
In the following code we get a UTC offset in xml. Since I want my WAP users in
UTC+02:00 to see data on a server in some US time zone, a lot of confusion will
be created from this behavior. Either I use .NET logic on the server and get
server local time or I create xhtml pages directly from serialized objects.
Eitherway I'll...
|
by: psy000 |
last post by:
Hi,
I have a C# web service client that talks to a JAVA application sever.
I use AXIS to generate the WSDL file, use wsdl.exe to generate proxy
stub c# code. When I try to use c# client connect to application
server, I did not get the result in the C# client side, I used a soap
monitor to look at the SOAP messages that were exchanged, I can...
|
by: Phil B |
last post by:
I am having a problem with a datetime from a web services provider
The provider is sending the following SOAP response
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"...
| |
by: ns21 |
last post by:
Our application is windows desktop application. We are using VS.Net 2003, C#,
Framework 1.1, SQL 2000. We use webservices to add/update/select objects. We
are using XML Serialization. Following is a sample object at CLIENT
public System.DateTime ContactDateTime
{
get { return _ContactDateTime; }
set { _ContactDateTime = value; }
}
|
by: a |
last post by:
I need to create an instance of a custom object 'School.Teacher' and use it
in a Profile object.
I'm developing a bad case of "Pretzel Logic" thinking about this.
Filling the custom object 'School.Teacher' as an ArrayList creates the
proper information (see aspx code below), but I'm unable to use this
ArrayList in the Profile object....
|
by: Jon Jon |
last post by:
1st please forgive me if I posted this to the wrong news group(s), news
group guidance would be appreciated.
Question: I have the following sample class generated from XSD.exe (Vs
2005). I would like to set an attribute
on each field (LastName,FirstName,etc) that indicates if the field is
ReadOnly/ViewOnly/Unrestricted. If I create
the...
|
by: Val |
last post by:
I have a complex object that I need to serialize. Rather than rely on a
standard routine, which is called during the serialization/deserialization, I
would like to be able to use my own functions that would convert this object
into a string and would then write that string to a file. Upon
deserialization, I need to be able to call another...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |