Link to home
Start Free TrialLog in
Avatar of EugeneC
EugeneC

asked on

Serialize objects c#

I am writing a spec for a project tracking system in c#.

A project consists of many tasks, ideally these tasks need to be automatically created when the project is created in the software application.

I have a project class and a task class.

I was thinking of storing the "auto-generated" tasks in a database table "tblAutoTasks".  

However I have been tasked to try and serialize these tasks as part of the project class.  For example when I create a project, a generic collection is created holding these tasks.  Does any of this make sense?  Any pointers would be appreciated.
Avatar of 2266180
2266180
Flag of United States of America image

Hi,

here are some examples with explanation on serialization:
http://www.codeproject.com/csharp/objserial.asp
http://www.c-sharpcorner.com/Language/serializingObjectsinCS.asp
You can find more info on the net if you need specific stuff (like serialization to xml or other format)

You will probably need to save the resulting serializaed data either in a blob like field (if your serialized objects are huge) or an array of bytes. (varchar) in your speific case, I dont think that a task could grow big enough to cause problems if stored in a varchar.
Avatar of EugeneC
EugeneC

ASKER

Hi

Thanks for that, could you provide me with an example?


All I need is a quick example of a project class that when created serializes a set of tasks.
the codeproject link comes with demo source code.
for you're case, you will have to modify the task class and add a  [Serializable()] to it
ASKER CERTIFIED SOLUTION
Avatar of gbzhhu
gbzhhu
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EugeneC

ASKER

Thanks a lot for your replies - currently I am on holiday and will be back at the end of the month - I look forward to trying your suggestions and will keep you informed.