SrgsDocument.Root 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置类的 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; }
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
属性值
返回指定为该 SrgsDocument规则的根规则。
示例
以下示例创建一winnerRule,从而使它 root rule 成为对象定义的 SrgsDocument 语法。
SrgsRule winnerRule = new SrgsRule("WorldCupWinner");
winnerRule.Scope = SrgsRuleScope.Public;
SrgsDocument document = new SrgsDocument();
document.Rules.Add(winnerRule);
document.Root = winnerRule;
注解
对象 SrgsRule 必须已位于文档中 SrgsRulesCollection ,然后才能将其设置为 根规则。
还可以通过使用SrgsRule对象作为构造函数的参数SrgsDocument来设置对象的根规则SrgsDocument。