Choices.ToGrammarBuilder Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a GrammarBuilder object from this Choices object.
public:
System::Speech::Recognition::GrammarBuilder ^ ToGrammarBuilder();
public System.Speech.Recognition.GrammarBuilder ToGrammarBuilder ();
member this.ToGrammarBuilder : unit -> System.Speech.Recognition.GrammarBuilder
Public Function ToGrammarBuilder () As GrammarBuilder
Returns
A GrammarBuilder that matches this Choices object.
Examples
The following example creates a speech recognition grammar for changing the background color.
private Grammar CreateColorChoice()
{
// Create a Choices object that contains a set of alternative colors.
Choices colorChoice = new Choices(new string[] {"red", "green", "blue"});
// Construct the phrase.
GrammarBuilder gb = new GrammarBuilder();
gb.Append(new Choices(new string[] {"Set", "Change"}));
gb.Append("background to");
gb.Append(colorChoice.ToGrammarBuilder());
Grammar grammar = new Grammar(gb);
grammar.Name = "modify background color";
return grammar;
}
Remarks
The GrammarBuilder returned by this method is equivalent to one returned by either of the following.
Calling the GrammarBuilder constructor with this object as the parameter.
Using the implicit or explicit cast of this object to a GrammarBuilder.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기