共用方式為


WordList.Add Method

WordList.Add Method

Adds a single string to the WordList object.

Definition

Visual Basic .NET Public Sub Add( _
ByVal s As String _
)
C# public void Add(
string s
);
Managed C++ public: void Add(
String *s
);

Parameters

s System.String. The 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.

Examples

[C#]

This C# example adds the word Microsoft to the WordList object that the RecognizerContext object, theRecognizerContext, uses.

RecognizerContext theRecognizerContext = new RecognizerContext();
WordList theWordList = new WordList();
theWordList.Add("Microsoft");
recoContext.WordList = theWordList;
        

[VB.NET]

This Microsoft® Visual Basic® .NET example adds the word Microsoft to the WordList object that the RecognizerContext object, theRecognizerContext, uses.

Dim theRecognizerContext As New RecognizerContext()
Dim theWordList As New WordList()
theWordList.Add("Microsoft")
theRecognizerContext.WordList = theWordList
        

See Also