XML 标签名称包括父项 class ASP.NET
XML Tag Name includes parent class ASP.NET
我根据以下 class
构建了一个 XML
public class Person
{
public string IDENTITY { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public class Exam[] Exams;
public class Exam
{
public string Name
public int Pass_Score
public int Score
public string Grade
}
public string Data { get; set; }
}
它生成了一个这样的文件:
<Person>
<Name>Jimmy</Name>
<Age>13</Age>
<Exams>
<Person.Exam >
<Name>Math</Name>
<Pass_Score>70</Pass_Score>
<Score>75</Score>
<Grade>C</Grade>
</Person.Exam>
<Exams>
<Data>21AUG</Date>
</Person>
我的标签有问题 <Person.Exam>
我怎样才能删除它或更改它的名称?
David Tansey 的回答说我必须把 class 移到外面。
public class Person
{
public string IDENTITY { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public Exam[] Exams;
public string Data { get; set; }
}
public class Exam
{
public string Name
public int Pass_Score
public int Score
public string Grade
}
我根据以下 class
构建了一个 XMLpublic class Person
{
public string IDENTITY { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public class Exam[] Exams;
public class Exam
{
public string Name
public int Pass_Score
public int Score
public string Grade
}
public string Data { get; set; }
}
它生成了一个这样的文件:
<Person>
<Name>Jimmy</Name>
<Age>13</Age>
<Exams>
<Person.Exam >
<Name>Math</Name>
<Pass_Score>70</Pass_Score>
<Score>75</Score>
<Grade>C</Grade>
</Person.Exam>
<Exams>
<Data>21AUG</Date>
</Person>
我的标签有问题 <Person.Exam>
我怎样才能删除它或更改它的名称?
David Tansey 的回答说我必须把 class 移到外面。
public class Person
{
public string IDENTITY { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public Exam[] Exams;
public string Data { get; set; }
}
public class Exam
{
public string Name
public int Pass_Score
public int Score
public string Grade
}