1
[XmlRoot("Person")]
Public class Person
{
[XmlElement("Name")]
public string Name{ get; set; }

[XmlElement("Age")]
public int Age{ get; set; }

[XmlElement("Gender")]
public string Gender{ get; set; }

}

This is my class. I'm creating XSD for this class using xsd.exe tool. I want to put some restrictions on these values like Name should not contain the numeric values, Age should not be negative and should not be greater than 99, gender should either male or Female. I don't want to modify the XSD manually. Is there any way to put such restrictions at class level and have them in XSD with help of xsd.exe tool?

4

0 回答 0