class has public variable, how NOT to serialize it  
Author Message
soconne





PostPosted: Visual C# Language, class has public variable, how NOT to serialize it Top

I have the following class:

class MyClass {
public long A;
public long B;
}

I want to serialize this class, but NOT the variable B. I could set B to be private but then I cannot access B from outside the class. Is there a way to tell the XmlSerialization class not to serialize a specific variable


Visual C#11  
 
 
louthy





PostPosted: Visual C# Language, class has public variable, how NOT to serialize it Top

class MyClass {
public long A;

[NonSerialized]
public long B;
}