[C#]XML Serialize Attribut/Element must have value

96 Views Asked by At

I got XMLIgnoreAttribute, VARSpecified to ignore or ignore-able value.

But is there any attribute to specified must have a value ?

I found this Attributes That Control XML Serialization, but nothing useful.

class Test
{
    [XMLIgnore]
    public string IgnoredValue;

    [XMLAttribute]
    public string AnAttribute;

    // If 'AnAttribute' length < 5 will be ignored
    public bool AnAttributeSpecified{get {return AnAttribute.Length > 5;};}

    // For this, it must have a value, is there any attribute for this?
    public string Name;
}
0

There are 0 best solutions below