SrgsDocument.Root Property
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.
Gets or sets the root rule of the SrgsDocument class.
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
Property Value
Returns the rule that is designated as the root rule of the SrgsDocument.
Examples
The following example creates a rule named winnerRule
, and then creates an SrgsDocument object named document
. The example then calls the Add method to add the rule to the document. Finally, the example sets the document's Root property to winnerRule
, thereby making it the root rule
for the grammar defined by the SrgsDocument object.
SrgsRule winnerRule = new SrgsRule("WorldCupWinner");
winnerRule.Scope = SrgsRuleScope.Public;
SrgsDocument document = new SrgsDocument();
document.Rules.Add(winnerRule);
document.Root = winnerRule;
Remarks
The SrgsRule object must already be in the document's SrgsRulesCollection before it can be set to the root rule.
You can also set the root rule for an SrgsDocument object by using an SrgsRule object as the argument to the SrgsDocument constructor.