<?xml version="1.0" encoding="UTF-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>將類別資料寫入 XML 檔</Title>
      <Author>Microsoft Corporation</Author>
      <Description>使用 XmlSerializer 類別將類別中的資料寫入 XML 檔。</Description>
      <Keywords>
      </Keywords>
      <Shortcut>xmlWriteClass</Shortcut>
    </Header>
    <Snippet>
      <References>
        <Reference>
          <Assembly>System.Xml.dll</Assembly>
          <Version/>
          <Url/>
        </Reference>
      </References>
      <Imports>
	    <Import>
			<Namespace>System.XML.Serialization</Namespace>
		</Import>
	    <Import>
			<Namespace>System.IO</Namespace>
		</Import>
      </Imports>
      <Declarations>
        <Literal>
          <ID>class</ID>
          <Type/>
          <ToolTip>取代為要序列化之類別的類型名稱。</ToolTip>
          <Default>ArrayList</Default>
        </Literal>
        <Literal>
          <ID>filename</ID>
          <Type/>
          <ToolTip>取代為要在其中寫入資料的檔案名稱。</ToolTip>
          <Default>"SerializedData.xml"</Default>
        </Literal>
        <Literal>
          <ID>dataInstance</ID>
          <Type/>
          <ToolTip>取代為包含資料的類別執行個體。</ToolTip>
          <Default>dataToWrite</Default>
        </Literal>
      </Declarations>
      <Code Language="VB" Kind="method decl"><![CDATA[Dim writer As New XMLSerializer(GetType($Class$))
Dim file As New StreamWriter($filename$)
writer.Serialize(file, $dataInstance$)
file.Close()]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
