WordList.Add Method (String)
Adds a single string to the WordList object.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Syntax
'Declaration
Public Sub Add ( _
s As String _
)
'Usage
Dim instance As WordList
Dim s As String
instance.Add(s)
public void Add(
string s
)
public:
void Add(
String^ s
)
public function Add(
s : String
)
Parameters
s
Type: System.StringThe string to add to the WordList object.
Remarks
The string passed in to the s parameter is not added if it already exists in the WordList object.
If a string is added to a word list, its capitalized versions are also implicitly added. For instance, adding "hello" implicitly adds "Hello" and "HELLO".
A WordList object can include string representations of words, phrases, part numbers, or any other string that a user might write that is not in the system dictionary.
There is a 256 character limit for words in a WordList. Using words longer than 256 characters will result in an invalid pointer exception when assigning the WordList to a RecognizerContext.
Examples
In this example, two WordList objects are created and words are added to their collections. Using the Merge method, the contents of the two WordList objects are combined. Finally, a RecognizerContext object is instantiated, and the first WordList object assigned to its WordList property.
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;
Platforms
Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Framework
Supported in: 3.0