-
June 15th, 2005, 12:08 AM
#1
What is a Serializable class?
Can anyone explain to me what is a Serializable class and what is the significance of Serialization? Please try to be as clear as possible as I'am new to VB.NET.
While BUG_IN_PROGRAM
ApplyPatch
wend
Private Sub ApplyPatch
BUG_IN_PROGRAM = True
End Sub
-
June 15th, 2005, 01:17 AM
#2
Re: What is a Serializable class?
For a class to be serializable means that it can be turned into a self describing XML (or binary XML) format.
The advantage of this is that you can serialize a class, store it (say in a database) and some time later pull it out and de-serialize it and you'll get back the exact same object you had before... even if the application which deserializes the class doesn't know the structure of the class.
Does that help you?
Mike
-
June 15th, 2005, 03:58 AM
#3
Re: What is a Serializable class?
Thanx very much for the valuable information!
While BUG_IN_PROGRAM
ApplyPatch
wend
Private Sub ApplyPatch
BUG_IN_PROGRAM = True
End Sub
-
June 15th, 2005, 08:48 AM
#4
Re: What is a Serializable class?
Ok that sounds good, but why would I want anything to be serializable and what makes a class serializable ( I mean what does this class has special beside keywords ). In other words, I don't see what's the point of this.
Nicolas Bohemier
-
June 15th, 2005, 10:59 AM
#5
Re: What is a Serializable class?
One big reason is so you can send it thru a wire to another app.
-
June 15th, 2005, 12:55 PM
#6
Re: What is a Serializable class?
I just used this in a program I am improving on for a company in Nova Scotia.
They use this to create "profiles" of information, which is held in a class to be used in another program.
We serialize the class to a file, then load that same class when using the actual program.
Very good way of storing and then moving class information.
- josh
-
June 15th, 2005, 03:47 PM
#7
Re: What is a Serializable class?
Ok I understand.. but what's the difference between serialize in XML and just write the class in a Binary file ?
Seems to me like both application needs the class definition anyway. So what's the difference ?
Nicolas Bohemier
-
June 15th, 2005, 04:31 PM
#8
Re: What is a Serializable class?
It's the same thing, just a different format.
Imports System.Runtime.Serialization.Formatters.Binary
vs.
Imports System.Runtime.Serialization.Formatters.Soap
-
June 16th, 2005, 07:48 AM
#9
Re: What is a Serializable class?
ok so it's just a fancy way of doing things that used to be in place for a long time. So mainly it's another Bell and whistle thing.
Nicolas Bohemier
-
June 16th, 2005, 08:15 AM
#10
Re: What is a Serializable class?
I can tell you that using XML is pretty convenient.
I am not sure if this is true of most other storage practices, but you can open the XML file with notepad, and see every piece of data, and it's value, which made debugging and understanding this program much easier than it could have been.
- Josh
-
June 16th, 2005, 10:59 AM
#11
Re: What is a Serializable class?
It can be interesting, but also, it's another way to expose your code. Though decompiling assemblies is quite simple if you don't obfuscate it.
Nicolas Bohemier
-
June 16th, 2005, 03:52 PM
#12
Re: What is a Serializable class?
Originally Posted by Boumxyz2
ok so it's just a fancy way of doing things that used to be in place for a long time. So mainly it's another Bell and whistle thing.
It is not just bell and whistle thing, XML serialization is required for transmistting data for WEBSERVICE.
So you serialize your object based on who you want to transmit it to. For example, sending the data to a webservice, you'd use XML but use binary if the endpoint is a .NET remoting service.
Good Luck,
-Cool Bizs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|