Serializing static class members

N

Nido

i have a class one of the member of the class is static to share
information amoung the objects. i have made the class serializable.
here i have a problem by serializing objects, information with in the
objects is saved. but i also want to save the information contained in
static member. is there any way around ? as C# does not serialize
static members of the class.
 
G

Guest

Hi,

What I usually do is to save the static class data in a custom
serialization, instead of serializing each of the variables I usually have a
struct with all the variables, then I serialize the struct when the apps
finishes and deserialize when the static constructor runs. Maybe there are
other ways

cheers
 
P

Pramod

Instead of serializing the Static variable
assign it to another variable and serialize that variable.

hope this works for u
Regards,
Pramod
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top