SpeechRecognitionEngine.MaxAlternates Property
Gets and sets the maximum number of candidate results an instance of SpeechRecognitionEngine is to return.
Assembly: System.Speech (in System.Speech.dll)
Applications obtain a list of all possible results as a collection of RecognizedPhrase instances through the Alternates property on RecognitionResult.
Alternates
The example below shows a handler for a TextChanged() event that allows end user to update the value of MaxAlternates.
private void _maxAltsInput_TextChanged(object sender, EventArgs e) {
int newMax;
newMax = _recognizer.MaxAlternates;
try {
newMax = int.Parse(_maxAltsInput.Text, System.Globalization.NumberStyles.Integer);
} catch (Exception exception) {
MessageBox.Show(
string.Format("Invalid Input: {0}\n Error Message: {1}",
_maxAltsInput.Text, exception.Message));
}
_recognizer.MaxAlternates = newMax;
_maxAltsInput.Text = _recognizer.MaxAlternates.ToString();
}
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
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.