Re: Serialization problem
From: Patrick Steele [MVP] (patrick_at_mvps.org)
Date: 07/27/04
- Next message: Donovan: "putting string into MemoryStream"
- Previous message: David Anton: "re:learning to go from vb.net to c#"
- In reply to: Picho: "Serialization problem"
- Next in thread: Picho: "Re: Serialization problem"
- Reply: Picho: "Re: Serialization problem"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 27 Jul 2004 12:04:08 -0400
In article <OgSrkn9cEHA.1656@TK2MSFTNGP09.phx.gbl>,
SPAM_picho@telhai.ac.il says...
> Hi all.
>
> Trying to serialize and desirialize an object. the object is transfered as a
> byte[] using a web service to the client. the client then has to deserialize
> the byte[] to an object and work with it.
>
> the object has a not-so-complicated graph constructed from several classes i
> made and fields of mostly simple types (string, int, enums) and bitmaps.
>
> I am getting an error on the client side saying "Object type cannot be
> converted to target type."
>
> I was afraid that since some of the properties are defined only as "get",
> the formatter cant reconstruct object state. to verify that, I added a line
> in the web service that desirializes the object too, and that works. seems
> like the "traffic on the web" (lol) has damaged the object?
>
> both web service and client use the same dll that holds the classes and the
> same version.
If both client and server will be running .NET, you'll probably get
better performance (and less problems) using remoting. The
serialization will done for you by the remoting framework. Your code
can be as simple as:
MyServerObject server = new MyServerObject();
server.Method1();
server.Method3(4, 3);
Yet "MyServerObject" is an object on a remote server.
-- Patrick Steele Microsoft .NET MVP http://weblogs.asp.net/psteele
- Next message: Donovan: "putting string into MemoryStream"
- Previous message: David Anton: "re:learning to go from vb.net to c#"
- In reply to: Picho: "Serialization problem"
- Next in thread: Picho: "Re: Serialization problem"
- Reply: Picho: "Re: Serialization problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|