Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用xmlserializer序列化此名称列表?_C#_Xml Serialization - Fatal编程技术网

C# 如何使用xmlserializer序列化此名称列表?

C# 如何使用xmlserializer序列化此名称列表?,c#,xml-serialization,C#,Xml Serialization,以XML为例: <Teaching StudyPoint="0" Description="xx" OtherDiscussionVideo="True" VideoAfterStudentItem="False"> <Theme>Test 1</Theme> <SourceMaterial>Material 1</SourceMaterial&g

以XML为例:

<Teaching StudyPoint="0" Description="xx" OtherDiscussionVideo="True" VideoAfterStudentItem="False">
    <Theme>Test 1</Theme>
    <SourceMaterial>Material 1</SourceMaterial>
    <Names>
        <Name Class="2">a</Name>
        <Name Class="3">b</Name>
        <Name Class="1">b</Name>
    </Names>
</Teaching>

如何序列化
名称
值列表?

教学
课内尝试以下内容:

public class Teaching {
    [XmlArrayItem("Name")]
    public Name[] Names;
}

教学
课内尝试以下内容:

public class Teaching {
    [XmlArrayItem("Name")]
    public Name[] Names;
}

谢谢结果证明我最终不需要
属性。因此,一个简单的
string[]
就成功了。谢谢,谢谢。结果证明我最终不需要
属性。因此,一个简单的
string[]
就成功了。谢谢