📜  xmldocument 到 c# 对象 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:07.480000             🧑  作者: Mango

代码示例1
void Main()
{
   String aciResponseData = "test";
   using(TextReader sr = new StringReader(aciResponseData))
   {
        var serializer = new System.Xml.Serialization.XmlSerializer(typeof(MyClass));
        MyClass response =  (MyClass)serializer.Deserialize(sr);
        Console.WriteLine(response.bar);
   }
}

[System.Xml.Serialization.XmlRoot("tag")]
public class MyClass
{
   public String bar;
}