將單一字串加入至 WordList 物件。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Sub Add ( _
s As String _
)
'用途
Dim instance As WordList
Dim s As String
instance.Add(s)
public void Add(
string s
)
public:
void Add(
String^ s
)
public void Add(
String s
)
public function Add(
s : String
)
參數
- s
型別:System.String
要加入至 WordList 物件的字串。
備註
如果 WordList 物件中已經有傳入至 s 參數的字串存在,就不會加入該字串。
如果將字串加入至單字清單,也會隱含加入其大寫版本。例如,加入 "hello" 會隱含加入 "Hello" 和 "HELLO"。
WordList 物件可以包含單字、片語、零件編號的字串表示,或使用者可能書寫但不是在「系統字典」中的其他任何字串。
WordList 中的單字長度上限為 256 個字元。若使用的單字超過 256 個字元,則在指派 WordList 給 RecognizerContext 時,將會產生無效的指標例外狀況 (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