<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>由事件記錄檔讀取特定應用程式建立的項目</Title>
      <Author>Microsoft Corporation</Author>
      <Description>在清單中填入應用程式的所有事件記錄檔項目。</Description>
      <Shortcut>evReadApp</Shortcut>
    </Header>
    <Snippet>
      <Imports>
        <Import>
          <Namespace>System</Namespace>
        </Import>
        <Import>
          <Namespace>Microsoft.VisualBasic</Namespace>
        </Import>
        <Import>
          <Namespace>System.Diagnostics</Namespace>
        </Import>
        <Import>
          <Namespace>System.Collections.Generic</Namespace>
        </Import>
      </Imports>
      <Declarations>
        <Literal>
          <ID>LogName</ID>
          <Type>String</Type>
          <ToolTip>取代為記錄檔名稱。這樣會讀取本機電腦上的應用程式記錄檔。</ToolTip>
          <Default>"Application"</Default>
        </Literal>
        <Literal>
          <ID>SourceName</ID>
          <Type>String</Type>
          <ToolTip>取代為來源名稱。寫入事件時，來源名稱會與特定應用程式相關聯。</ToolTip>
          <Default>"SourceName"</Default>
        </Literal>
      </Declarations>
      <Code Language="VB" Kind="method body"><![CDATA[Dim log As New EventLog($LogName$)
Dim entries As New List(Of EventLogEntry)
For Each entry As EventLogEntry In log.Entries
    If entry.Source = $SourceName$ Then
        entries.Add(entry)
    End If
Next]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
