Click here to Skip to main content
15,905,325 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

Can any one Please tell me what is the use of defining a class as serializable.
How the class behaves when it is serializable


Regards
Chaithanya
Posted

1 solution

You need to get a book/tutorial or simply should have Googled.

Read about "What is Serialization?"
Start from here: Introduction to serialization[^]

About the attribute you asked, here:
SerializableAttribute[^]
All attribute does is mark the class as serializable.
 
Share this answer
 
Comments
M.CHAITHANYA 5-May-11 4:46am    
Hi,
Happened to read the link provided by you,But i couldn't get one thing:why an object should be persisted ,when and where we use this persisted object.

Regards
Chaithanya M
Sandeep Mewara 5-May-11 4:59am    
Persistence means what? There would be times when you need the state/data of an object shared across and there you need it.

M.CHAITHANYA 5-May-11 5:18am    
persisted is storing object for a long period (may be for life time).i have an eg:

namespace System
{
// Summary:
// Represents the method that will handle an event that has no event data.
//
// Parameters:
// sender:
// The source of the event.
//
// e:
// An System.EventArgs that contains no event data.
[Serializable]
[ComVisible(true)]
public delegate void EventHandler(object sender, EventArgs e);
}


here Delegate "Eventhandler" is prefixed with attribute [serializable],can you please take this example and expalin me what actually happens behind the scenes

Regards
Chaithanya M
Sergey Alexandrovich Kryukov 5-May-11 17:04pm    
Please don't ask questions you have not idea about. It won't give you an idea. Read the referenced matter first. You serialize data types, not methods. You also need to read about delegate and events. Basic reading first, to ask something that makes sense.
--SA
Sergey Alexandrovich Kryukov 5-May-11 17:05pm    
Sandeep, 5 for your answer, but it's not helping -- just yet. I guess you will have to continue to talking... :-)
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900