question about [Serializable]

  • Thread starter Thread starter raffelm
  • Start date Start date
R

raffelm

I have class that I made [Serializable]. However, there is a member
variable that I do not want to be saved when the class is written out.
Is there a way to turn serialization off for the one member variable?

Thnx
Matt
 
Matt,
From MSDN documenation:
"To prevent serialization of an instance variable, you can use the
<NonSerialized()> attribute on the variable declaration. This will prevent
the serializer from making any attempt to copy that variable into the byte
stream-including preventing it from attempting to serialize a child object
if the variable holds an object reference."

Hope this helps
rc
 
Attach the [NonSerialized] attribute to that member variable.

-Rob Teixeira [MVP]
 
Back
Top