   [C#] ContentSerializerIgnore is not stopping class properties from being serialized?
  If I have a simple class:    public class Tile3D    {   [ContentSerializerIgnore]   public Vector3 position;   public Quadrangle[] quads;   public Tile3D_Type type; public Tile3D()   {  quads = new Quadrangle[6];   }    }Why does position still get serialized even when the [ContentSerializerIgnore] attribute is used?My method for serializing the data is as follows:   private void XMLSave(object sender, System.EventArgs e)   {  object testValue = Game1.Instance.level3D.data;  if (testValue == null)  { return;  }  XmlWriterSettings settings = new XmlWriterSettings();  settings.Indent = true;  using (XmlWriter xmlWriter = XmlWriter.Create("LevelMap.xml", settings))  { IntermediateSerializer.Serialize(xmlWriter, testValue, null);  }   }
  Have you tried the XmlIgnore attribute?   ;  Try [NonSerialized]   ;  Note that "public Vector3 position;" is not a property, but a public member variable.   ;Quote:Original post by phresnelNote that "public Vector3 position;" is not a property, but a public member variable.All solved now, thanks guys. It seems I need to add [ContentSerializerIgnore] above every public member that I don't want to be serialized, which makes sense.The attribute also works with public members aswell as properties.   ;Quote:Original post by Spa8nkyQuote:Original post by phresnelNote that "public Vector3 position;" is not a property, but a public member variable.All solved now, thanks guys. It seems I need to add [ContentSerializerIgnore] above every public member that I don't want to be serialized, which makes sense.The attribute also works with public members aswell as properties.Indeed, attributes always only apply to the next following entity.