Meaning of Serializable
-
I saw many examples over the net like
[Serializable] public class Customer { }
What is the meaning of the Serializable...? What it will do..?:confused:Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...
-
I saw many examples over the net like
[Serializable] public class Customer { }
What is the meaning of the Serializable...? What it will do..?:confused:Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...
Since nobody is around to give you a better explanation, I'll give you a real light view: It basically means that the object/data can be persisted beyond the lifetime of your application - that is, saved. Written down somewhere. Like on disk. The real meaning is actually more abstract than that, but this is a pretty good start. Do some searching in Google or in the MS SDK documentation, you'll see a lot more on it.
-
I saw many examples over the net like
[Serializable] public class Customer { }
What is the meaning of the Serializable...? What it will do..?:confused:Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...
-
Here's a page in the SDK documentation about it. http://msdn2.microsoft.com/en-us/library/72hyey7b(VS.71).aspx[^]
JoeRip, Thanks for your reply. But I can't get the line "It basically means that the object/data can be persisted beyond the lifetime of your application - that is, saved. Written down somewhere. Like on disk." If My application is closed then how would I know the object is persist or not...? If persist then what is the name of it and how can I access it...? And when I set objCustomer=null then it automatically destroyed and if I can't do this the GC will automatically clear it from memory.... Please reply....
Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...
modified on Saturday, December 15, 2007 3:33:31 AM
-
JoeRip, Thanks for your reply. But I can't get the line "It basically means that the object/data can be persisted beyond the lifetime of your application - that is, saved. Written down somewhere. Like on disk." If My application is closed then how would I know the object is persist or not...? If persist then what is the name of it and how can I access it...? And when I set objCustomer=null then it automatically destroyed and if I can't do this the GC will automatically clear it from memory.... Please reply....
Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...
modified on Saturday, December 15, 2007 3:33:31 AM
You have to write the code to serialize the object to a file on disk, or some other data store. It doesn't happen automatically.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
JoeRip, Thanks for your reply. But I can't get the line "It basically means that the object/data can be persisted beyond the lifetime of your application - that is, saved. Written down somewhere. Like on disk." If My application is closed then how would I know the object is persist or not...? If persist then what is the name of it and how can I access it...? And when I set objCustomer=null then it automatically destroyed and if I can't do this the GC will automatically clear it from memory.... Please reply....
Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...
modified on Saturday, December 15, 2007 3:33:31 AM
You didn't ask how to do it, you asked what it meant. If you follow the link I sent you, it's all explained. Some of the existing .NET / CLR classes are already serializable, meaning the work has been done to allow you to serialize them. For your own objects, there is plenty of information in MSDN on how to write specific serialization code. Start at the link I gave you.