SrgsDocument.Root Özellik

Tanım

Sınıfın kök kuralını alır veya ayarlar SrgsDocument .

public:
 property System::Speech::Recognition::SrgsGrammar::SrgsRule ^ Root { System::Speech::Recognition::SrgsGrammar::SrgsRule ^ get(); void set(System::Speech::Recognition::SrgsGrammar::SrgsRule ^ value); };
public System.Speech.Recognition.SrgsGrammar.SrgsRule Root { get; set; }
member this.Root : System.Speech.Recognition.SrgsGrammar.SrgsRule with get, set
Public Property Root As SrgsRule

Özellik Değeri

SrgsRule

Kök kuralı olarak atanan kuralı döndürür SrgsDocument .

Örnekler

Aşağıdaki örnek adlı bir kural oluşturur winnerRule ve sonra adlı bir nesne oluşturur SrgsDocument document . Örnek sonra, Add kuralı belgeye eklemek için yöntemini çağırır. Son olarak, örnek belgenin Root özelliğini olarak ayarlar ve winnerRule böylece root rule nesne tarafından tanımlanan dilbilgisinde olur SrgsDocument .

SrgsRule winnerRule = new SrgsRule("WorldCupWinner");  
winnerRule.Scope = SrgsRuleScope.Public;  

SrgsDocument document = new SrgsDocument();  

document.Rules.Add(winnerRule);  
document.Root = winnerRule;   

Açıklamalar

SrgsRuleNesne, SrgsRulesCollection kök kurala ayarlanmadan önce belgede zaten olmalıdır.

Ayrıca, SrgsDocument SrgsRule Oluşturucu için bağımsız değişken olarak bir nesnesi kullanarak bir nesne için kök kuralı da ayarlayabilirsiniz SrgsDocument .

Şunlara uygulanır

Ayrıca bkz.