I want to ignore all elements of Dictionary while serializing as those members cause an exception
example class:
public class TestClass{
public string StringTest { get; set; }
public int IntTest { get; set; }
public Dictionary<int, string> someDictionary { get; set; }
}
What i tried(unsuccessfull)
XmlAttributeOverrides xOver = new XmlAttributeOverrides();
XmlAttributes attrs = new XmlAttributes();
attrs.XmlIgnore = true;
xOver.Add(typeof(Dictionary<int, string>), attrs);
XmlSerializer serialiser = new XmlSerializer(objectToConvert.GetType(), xOver);
serialiser.Serialize(writer, objectToConvert);