PDA

Click to See Complete Forum and Search --> : converting a class to string and sending it over the net?


MrPolite
Nov 9th, 2002, 11:24 PM
I have a class which contains some variables (strings and integers). Is there an easy way to convert the whole class to string?
what I want to do is to send the class to another instance of my app over the internet, so I'm assuming it has to be converted to text first. I'm just wondering if there is an easy way for this. Because I actually have like 10 classes and each of them have many different variables in them. Converting a string representation of each to its correct class type would be a little annoying. So is there an easy way to do this?:rolleyes:

Edneeis
Nov 10th, 2002, 12:41 AM
You could serialize it to xml.

MrPolite
Nov 10th, 2002, 01:49 AM
Originally posted by Edneeis
You could serialize it to xml. :eek: Glad to hear there is a way!!! :) :) :)
I will take a look at it later, thanks.

hellswraith
Nov 10th, 2002, 12:32 PM
That is exactly why serialization was created in .Net. You can send objects easily over the Internet.

Lethal
Nov 10th, 2002, 12:46 PM
Yep. Xml is great (Assuming you are serializing into Xml). I use it extensively with XSL at my job site.

PT Exorcist
Nov 10th, 2002, 04:56 PM
http://www.eponymous.eclipse.co.uk/dotnetfaq.htm#Serialization