SrgsDocument.Root Property

Definition

Gets or sets the root rule of the SrgsDocument class.

public System.Speech.Recognition.SrgsGrammar.SrgsRule Root { get; set; }

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.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

See also