日期:2014-05-17 浏览次数:20989 次
//test xml
string input = @"<xml>" +
@"<code>0</code>" +
@" <message>Success</message>" +
@"<roles>" +
@"<role><name>Role1</name><selected>false</selected></role>" +
@"<role><name>Role2</name><selected>true</selected></role>" +
@"</roles>" +
@"</xml>";
XmlSerializer serializer = new XmlSerializer(typeof(Response), "");
using (TextReader reader = new StringReader(input))
{
Response result = serializer.Deserialize(reader) as Response;
}
[Serializable]
[XmlRoot(ElementName= "xml")]