文章編號: 949730 - 上次校閱: 2008年2月26日 - 版次: 1.0

MCTS Self-Paced 訓練套件 (測驗 70 536): Microsoft ?.NET Framework 2.0 — 應用程式開發基礎註解和更正第 3

系統提示本文適用於您使用的作業系統之外的作業系統。與您不相關的文章內容已停用。

在此頁中

全部展開 | 全部摺疊

結論

這份文件包含註解、 更正,與 Microsoft 按活頁簿的相關的已知錯誤的相關資訊 MCTS Self-Paced 訓練套件 (測驗 70 536): Microsoft ?.NET Framework 2.0 — 應用程式開發基礎,0-7356-2277年-9。這本書的額外修正可用於文章 923018 (http://support.microsoft.com/kb/923018/) 935218 (http://support.microsoft.com/kb/935218/) ,和 949734 (http://support.microsoft.com/kb/949734/)

將會涵蓋下列主題:

  • 頁面 512: 在頁面上的第一段不正確
  • 頁面 529: 未完成步驟 2 中的資訊實驗室
  • 頁面 544-545: ConfigurationSection 需要建立一個自訂建構函式
  • 頁面 546: 組態類別參考 ConfigurationManager 類別的位置
  • 頁面 549: 建議作法標題校正
  • [圖 10-2 標題中參考事件記錄] 的位置的頁面 556: 應用程式
  • 頁面 564-565: 的詞彙方法用來取代成員
  • 偵錯類別的 Write 方法頁面 567: 不正確描述
  • WriteLine 方法的偵錯類別的頁面 568: 不正確描述
  • 前一版的.NET Framework 的頁面 579: 不正確參考
  • 頁面 579: 方法參考的工作屬性的位置
  • 頁面 582: DelimmedListTraceListener 代替 DelimitedListTraceListener 參考
  • 頁面 582-583: 方法參考的成員的位置
  • 頁面 584: 不正確的組態檔程式碼
  • 頁面 590: MyListener Trace.Listeners 集合中不加入
  • 頁面 600: [圖 10-13] 的影像不正確
  • 頁面 601: [圖 10-14] 的影像不正確
  • 頁面 606: 這程式碼範例中使用 Me 的位置
  • 頁面 606: 不正確變數的宣告中第二個程式碼範例
  • 頁面 606: tbFileName Process.Start 陳述式,在第三個的程式碼範例中不使用
  • 頁面 607: 不正確圖 10-15
  • 頁面 608: tbUsername 用 tbUserName 取代
  • 頁面 612: XmlTextWriterListener 應該是 XmlWriterTraceListener
  • 頁面 616: DirectoryObjectSearcher"使用來代替 ManagementObjectSearcher"
  • 頁面 619: IP_Address 用 IP_Enabled 取代
  • 頁面 621: 不正確使用步驟 5 中的指示詞

其他相關資訊

頁面 512: 在頁面上的第一段不正確

在頁 512,在頁面上的第一個段落是在 448] 頁面上第一個段落的重製。 請忽略此段落。

頁面 529: 未完成步驟 2 中的資訊實驗室

在頁面 529,會讀取 「 實驗室的步驟 2:

「 選取執行階段安全性原則] 節點"

應該閱讀:

選取執行階段安全性原則] 節點中並選取增加組件信任] 選項。

頁面 544-545: ConfigurationSection 需要建立一個自訂建構函式

在頁面 544-545 步驟 7 和 8 閱讀:

"7.選取 [Program.cs] 或 [Module1.vb 檔案並開啟它。建立新的靜態/共用方法沒有傳回的型別具有並命名 WriteSettings,如下所示:
' VB
Private Shared Sub WriteSettings()
End Sub

// C#
private static void WriteSettings()
{};

8. Insert the following code into the method:

' VB
Private Shared Sub WriteSettings()

	Try

		Dim LabSection As ConfigurationSection
		Dim config As _
			System.Configuration.Configuration = _
			ConfigurationManager.OpenExeConfiguration( _
			ConfigurationUserLevel.None)
		If config.Sections("LabSection") Is Nothing Then
			LabSection = New ConfigurationSection()
			config.Sections.Add("LabSection", ConfigurationSection)
			customSection.SectionInformation.ForceSave = True
			config.Save(ConfigurationSaveMode.Full)
		End If

		Catch ex As ApplicationException
			Console.WriteLine(ex.ToString())
	End Try
End Sub

// C#
try
	{
	ConfigurationSection LabSection;

	// Get the current configuration file.
	System.Configuration.Configuration config =
		ConfigurationManager.
		OpenExeConfiguration(ConfigurationUserLevel.None);

	if (config.Sections["LabSection"] == null)
		{
		customSection = new ConfigurationSection();
		config.Sections.Add("LabSection", ConfigurationSection);
		customSection.SectionInformation.ForceSave = true;
		config.Save(ConfigurationSaveMode.Full);
		}
	}
catch (ApplicationException ex)
	{
	Console.WriteLine(ex.ToString());
	}
"

他們應該閱讀:

"7.選取 [Program.cs] 或 [Module1.vb 檔案並開啟它。建立新的靜態/共用方法沒有傳回的型別具有並命名 WriteSettings,如下所示:
' VB
Private Shared Sub WriteSettings()
End Sub

// C#
private static void WriteSettings()
{};

Create a new public class called CustomSection, as shown here:

' VB
Public Class CustomSection
	Inherits ConfigurationSection
End Class

//C#
public class CustomSection : ConfigurationSection
{
	public CustomSection()
	{ }
}

8. Insert the following code into the method:

' VB
Try
	Dim customSection As CustomSection
	Dim config As _
	System.Configuration.Configuration = _
	ConfigurationManager.OpenExeConfiguration( _
	ConfigurationUserLevel.None)
	If config.Sections("LabSection") Is Nothing Then
		customSection = New CustomSection()
		config.Sections.Add("LabSection", customSection)
		customSection.SectionInformation.ForceSave = True
		config.Save(ConfigurationSaveMode.Full)
	End If
Catch ex As ApplicationException
	Console.WriteLine(ex.ToString())
End Try

// C#
try
	{
	CustomSection customSection;

	// Get the current configuration file.
	System.Configuration.Configuration config =
		ConfigurationManager.
		OpenExeConfiguration(ConfigurationUserLevel.None);

	if (config.Sections["LabSection"] == null)
		{
		customSection = new CustomSection();
		config.Sections.Add("LabSection", customSection);
		customSection.SectionInformation.ForceSave = true;
		config.Save(ConfigurationSaveMode.Full);
		}
	}
catch (ApplicationException ex)
	{
	Console.WriteLine(ex.ToString());
	}
"

頁面 546: 組態類別參考 ConfigurationManager 類別的位置

在頁面 546 上, 第一個課程檢閱質疑讀取:

"設定類別的哪一個方法是開啟組態檔的有效方法?(選擇所有套用)"。

應該閱讀:

"ConfigurationManager 類別的哪一個方法是開啟組態檔的有效方法?(選擇所有套用)"。

頁面 549: 建議作法標題校正

在頁面 549 下建議作法, 標題它讀取:

"使用應用程式定義域建立隔離的.NET Framework 應用程式內的公用語言執行時間單位"

應該閱讀:

內嵌至.NET Framework 應用程式的組態管理功能。

[圖 10-2 標題中參考事件記錄] 的位置的頁面 556: 應用程式

在頁面 556,標題到 [圖 10-2 會讀取:

「 Windows 事件檢視器建立並寫入 Chap10Demo 應用程式後"

應該閱讀:

「 Windows 事件檢視器建立並寫入 Chap10Demo 事件記錄檔後"

頁面 564-565: 的詞彙方法用來取代成員

在頁面 564,最後一句會讀取:

這些方法會列出資料表 10-1。

應該閱讀:

這些成員會列表 10-1。

在頁面 565,標題的表格 10-1 會讀取:

「 偵錯工具類別的方法"

應該閱讀:

「 偵錯工具類別成員 」

偵錯類別的 Write 方法頁面 567: 不正確描述

在頁面 567,Write 方法表格 10-2 的描述會讀取:

"Listeners 集合中寫入附加偵錯或追蹤類別接聽項物件的相關資訊 >。

應該閱讀:

"將資訊寫入附加偵錯或追蹤類別接聽程式集合中物件 Listeners"。

WriteLine 方法的偵錯類別的頁面 568: 不正確描述

在頁面 568,WriteLine 方法表格 10-2 的描述會讀取:

"Listeners 集合中寫入附加偵錯或追蹤類別接聽項物件的相關資訊 >。

應該閱讀:

"將資訊寫入附加偵錯或追蹤類別接聽程式集合中物件 Listeners"。

前一版的.NET Framework 的頁面 579: 不正確參考

在頁面 579,DebuggerStepThroughAttribute 區段的第四個句子會讀取:

"在舊版本的.NET Framework,每次您建立一個 Winform 比方說這個屬性加入。 InitializeComponent 方法"

應該閱讀:

"在 Visual Basic.NET 和 Visual Basic 2005,每次您建立一個 Winform 比方說這個屬性會套用至 InitializeComponent 方法"。

頁面 579: 方法參考的工作屬性的位置

在頁面 579,DebuggerStepThroughAttribute 區段的第二個句子會讀取:

"不像 [DebuggerHiddenAttribute 不過,這個方法告知偵錯工具進入程式碼,而不是從輸出中隱藏"。

應該閱讀:

"不像 [DebuggerHiddenAttribute 不過,這個屬性告訴偵錯工具進入程式碼,而不是從輸出中隱藏"。

頁面 582: DelimmedListTraceListener 代替 DelimitedListTraceListener 參考

在頁面 582,Trace 類別區段的第二個句子會讀取:

Visual Studio 2005 有許多接聽程式物件內建的包括 XmlTraceListener、 DefaultTraceListener、 DelimmedListTraceListener 及 EventLogTraceListener。

應該閱讀:

Visual Studio 2005 有許多接聽程式物件內建的包括 XmlTraceListener、 DefaultTraceListener、 DelimitedListTraceListener 及 EventLogTraceListener。

頁面 582-583: 方法參考的成員的位置

在頁面 582,Trace 類別區段的第三個句子會讀取:

"最有用的方法清單係表 10-4"。

應該閱讀:

"提供了清單的最有用的成員表格 10-4"。

表 10-4 的標題會讀取:

「 追蹤類別的方法"

應該閱讀:

「 追蹤類別成員 」

在頁面上 583 表 10-4 讀取後第一句:

"因為這些方法是那些關於偵錯類別較早的 < > 一節中所描述相同,或是它們是自我闡明 let’s 上移動"。

應該閱讀:

"因為這些成員是那些關於偵錯類別較早的 < > 一節中所描述相同,或是它們是自我闡明 let’s 上移動"。

頁面 584: 不正確的組態檔程式碼

在頁面 584,第四行的第一個程式碼範例會讀取:

<add name="DemoApp" value="2" />

應該閱讀:

<add name="DemoApp.Switch" value="Information"/>


頁面 590: MyListener Trace.Listeners 集合中不加入

在頁面 590,步驟 4 的程式碼範例會讀取:

' VB
Trace.Listeners.Clear()
Dim MyLog as New EventLog("Chapter10", "localhost", "Chapter10Demo")
Trace.AutoFlush = True
Dim MyListener as EventLogTraceListener = new EventLogTraceListener(MyLog)
Trace.WriteLine("This is a test")

// C#
EventLog MyLog = new EventLog("Chapter10", "localhost", "Chapter10Demo");
Trace.AutoFlush = true;
EventLogTraceListener MyListener = new EventLogTraceListener(MyLog);
Trace.WriteLine("This is a test");

應該閱讀:

' VB
Trace.Listeners.Clear()
Dim MyLog as New EventLog("Chapter10", "localhost", "Chapter10Demo")
Trace.AutoFlush = True
Dim MyListener as EventLogTraceListener = new EventLogTraceListener(MyLog)
Trace.Listeners.Add(MyListener)
Trace.WriteLine("This is a test")

// C#
EventLog MyLog = new EventLog("Chapter10", "localhost", "Chapter10Demo");
Trace.AutoFlush = true;
EventLogTraceListener MyListener = new EventLogTraceListener(MyLog);
Trace.Listeners.Add(MyListener);
Trace.WriteLine("This is a test");


頁面 600: [圖 10-13] 的影像不正確

在頁面 600,影像圖 10-13 應以頁面 601 上的 [圖 10-14] 從影像來取代。

頁面 601: [圖 10-14] 的影像不正確

在頁面 601,影像圖 10-14 應以上頁 607 圖 10-15] 從影像來取代。

頁面 606: 這程式碼範例中使用 Me 的位置

在頁面 606,會讀取第一個程式碼範例的第三行:

Info.FileName = this.tbProcessName.Text

應該閱讀:

Info.FileName = Me.tbProcessName.Text


頁面 606: 不正確變數的宣告中第二個程式碼範例

在頁面 606,會讀取第二個程式碼範例的第三行:

String FileName = "C:\ProcessStartDemo.exe"

應該閱讀:

Dim FileName As String = "C:\ProcessStartDemo.exe"


頁面 606: tbFileName Process.Start 陳述式,在第三個的程式碼範例中不使用

在頁面 606,第三個程式碼範例會讀取:

' VB
Dim SecurePassword As New SecureString
For i As Int32 = 0 To Me.tbPassword.Text.Length - 1
	SecurePassword.AppendChar(Convert.ToChar(Me.tbPassword.Text(i)))
Next
Process.Start(Me.tbUserName.Text, Me.tbUserName.Text, SecurePassword, Me.tbDomain.Text)

// C#
SecureString SecurePassword = new SecureString();
for (Int32 i = 0; i < this.tbPassword.Text.Length; i++)
{
	SecurePassword.AppendChar(Convert.ToChar(this.tbPassword.Text[i]));
}
Process.Start(this.tbUserName.Text, this.tbPassword.Text, SecurePassword , this.tbDomain.Text);

應該閱讀:

' VB
Dim SecurePassword As New SecureString
For i As Int32 = 0 To Me.tbPassword.Text.Length - 1
	SecurePassword.AppendChar(Convert.ToChar(Me.tbPassword.Text(i)))
Next
Process.Start(Me.tbFileName.Text, Me.tbUserName.Text, SecurePassword, Me.tbDomain.Text)

// C#
SecureString SecurePassword = new SecureString();
for (Int32 i = 0; i < this.tbPassword.Text.Length; i++)
{
	SecurePassword.AppendChar(Convert.ToChar(this.tbPassword.Text[i]));
}
Process.Start(this.tbFileName.Text, this.tbUserName.Text, SecurePassword,
    this.tbDomain.Text);


頁面 607: 不正確圖 10-15

在頁面 607,[圖 10-15 不正確。 請忽略此圖。

頁面 608: tbUsername 用 tbUserName 取代

在頁面 608,C# 程式碼範例的第八個行讀取:

if (this.tbUsername.Text != String.Empty)

應該閱讀:

if (this.tbUserName.Text != String.Empty)


頁面 612: XmlTextWriterListener 應該是 XmlWriterTraceListener

頁面 612 上, 第四個句子中第二個項目符號點會包含一參照至 XmlTextWriterListener 的不正確。

變更:
"[XmlTextWriterListener 允許偵錯和追蹤輸出的詳細資訊儲存在預先定義的 Xml 屬性中寫入"。

至:
"[XmlWriterTraceListener 允許偵錯和追蹤輸出的詳細資訊儲存在預先定義的 Xml 屬性中寫入"。

頁面 616: DirectoryObjectSearcher"使用來代替 ManagementObjectSearcher"

在頁面 616,有幾個地方 DirectoryObjectSearcher"使用來代替"ManagementObjectSearcher 」 的執行個體列舉管理物件] 下面的段落的第一個句子會讀取:

「 [System.Management 核心命名空間是 DirectoryObjectSearcher 物件以程式設計的方式透過 WMI 存取資源的哪些 ccan 」。

應該閱讀:

「 [System.Management 核心命名空間是 ManagementObjectSearcher 物件以程式設計的方式透過 WMI 存取資源的哪些 ccan 」。

同一個段落的最後一句會讀取:

"需要執行下列步驟來執行查詢,使用 [DirectoryObjectSearcher,:"

應該閱讀:

"需要執行下列步驟來執行查詢,使用 [ManagementObjectSearcher,:"

步驟 # 2 讀取:

宣告 DirectoryObjectSearcher 類別的執行個體。

應該閱讀:

宣告 ManagementObjectSearcher 類別的執行個體。

步驟 # 5 讀取:

建立一個 ManagementObjectCollection 中並設定它至傳回的值從 DirectoryObjectSearcher 的 Get 方法。

應該閱讀:

建立一個 ManagementObjectCollection 中並設定它至傳回的值從 ManagementObjectSearcher 的 Get 方法。

頁面 619: IP_Address 用 IP_Enabled 取代

在頁面 619,28 行的程式碼範例會讀取:

if (Convert.ToBoolean(DemoManager[IP_Address]) == true)

應該閱讀:

if (Convert.ToBoolean(DemoManager[IP_Enabled]) == true)


頁面 621: 不正確使用步驟 5 中的指示詞

在頁面 621,在步驟 5 中的 C# 程式碼範例會讀取:

Using System.Diagnostics;
Imports System.Management;

應該閱讀:

using System.Diagnostics;
using System.Management;


Microsoft 按將致力於提供有用的資訊和精確的書籍。所有註解和更正上列準備就緒可納入本書的未來 printings。如果您本書的再版它可能已經包含大部分或所有上述的更正。

這篇文章中的資訊適用於:
  • MCTS Self-Paced Training Kit (Exam 70-536): Microsoft .NET Framework 2.0 - Application Development Foundation, ISBN 0-7356-2277-9
關鍵字:?
kbmt KB949730 KbMtzh
機器翻譯機器翻譯
重要:本文是以 Microsoft 機器翻譯軟體翻譯而成,而非使用人工翻譯而成。Microsoft 同時提供使用者人工翻譯及機器翻譯兩個版本的文章,讓使用者可以依其使用語言使用知識庫中的所有文章。但是,機器翻譯的文章可能不盡完美。這些文章中也可能出現拼字、語意或文法上的錯誤,就像外國人在使用本國語言時可能發生的錯誤。Microsoft 不為內容的翻譯錯誤或客戶對該內容的使用所產生的任何錯誤或損害負責。Microsoft也同時將不斷地就機器翻譯軟體進行更新。
按一下這裡查看此文章的英文版本:949730? (http://support.microsoft.com/kb/949730/en-us/ )
Microsoft及(或)其供應商不就任何在本伺服器上發表的文字資料及其相關圖表資訊的恰當性作任何承諾。所有文字資料及其相關圖表均以「現狀」供應,不負任何擔保責任。Microsoft及(或)其供應商謹此聲明,不負任何對與此資訊有關之擔保責任,包括關於適售性、適用於某一特定用途、權利或不侵權的明示或默示擔保責任。Microsoft及(或)其供應商無論如何不對因或與使用本伺服器上資訊或與資訊的實行有關而引起的契約、過失或其他侵權行為之訴訟中的特別的、間接的、衍生性的損害或任何因使用而喪失所導致的之損害、資料或利潤負任何責任。