Aracılığıyla paylaş


Choices.ToGrammarBuilder Yöntem

Tanım

Bu Choices nesneden bir GrammarBuilder nesne döndürür.

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

Döndürülenler

GrammarBuilder

GrammarBuilder Bu Choices nesneyle eşleşen bir.

Örnekler

Aşağıdaki örnek, arka plan rengini değiştirmek için bir konuşma tanıma dil bilgisi oluşturur.

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;  
}  

Açıklamalar

GrammarBuilder Bu yöntem tarafından döndürülen, aşağıdakilerden biri tarafından döndürülene eşdeğerdir.

  • Oluşturucuyu GrammarBuilder parametresi olarak bu nesneyle çağırma.

  • Bu nesnenin örtük veya açık atamasını kullanarak öğesine GrammarBuilder.

Şunlara uygulanır

Ayrıca bkz.