共用方式為


WordList.Add 方法 (array<String[])

將包含單字的字串陣列加入至 WordList

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public Sub Add ( _
    words As String() _
)
'用途
Dim instance As WordList
Dim words As String()

instance.Add(words)
public void Add(
    string[] words
)
public:
void Add(
    array<String^>^ words
)
public void Add(
    String[] words
)
public function Add(
    words : String[]
)

參數

備註

如果 WordList 物件中已經有包含在 words 參數陣列中的任何字串,就不會加入該字串。

如果將字串加入至單字清單,也會隱含加入其大寫版本。例如,加入 "hello" 會隱含加入 "Hello" 和 "HELLO"。

WordList 物件可以包含單字、片語、零件編號的字串表示,或使用者可能書寫但不是在「系統字典」中的其他任何字串。

WordList 中的單字長度上限為 256 個字元。若使用的單字超過 256 個字元,則在指派 WordListRecognizerContext 時,將會產生無效的指標例外狀況 (Exception)。

範例

在這個範例中,會建立兩個 WordList 物件並在其集合中加入文字。若使用 Merge 方法,則會合併兩個 WordList 物件的內容。最後會具現化 RecognizerContext 物件,並將第一個 WordList 物件指派至其 WordList 屬性。

Dim wList1 As WordList = New WordList()
Dim wList2 As WordList = New WordList()
' add a single word to wList1
wList1.Add("thunk")
' add an array of words to wList2
Dim words() As String = {"Microsoft", "Tablet", "PC"}
wList2.Add(words)
' merge wList2 into wList1
wList1.Merge(wList2)
' create a new RecognizerContext object and assign wList1
Dim RC As RecognizerContext = New RecognizerContext()
RC.WordList = wList1
WordList wList1 = new WordList();
WordList wList2 = new WordList();
// add a single word to wList1
wList1.Add("thunk");
// add an array of words to wList2
string[] words = { "Microsoft", "Tablet", "PC" };
wList2.Add(words);
// merge wList2 into wList1
wList1.Merge(wList2);
// create a new RecognizerContext object and assign wList1
RecognizerContext RC = new RecognizerContext();
RC.WordList = wList1;

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

WordList 類別

WordList 成員

Add 多載

Microsoft.Ink 命名空間