Grammar.RuleName 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 the name of the root rule or entry point of a Grammar object.
public:
property System::String ^ RuleName { System::String ^ get(); };
public string RuleName { get; }
member this.RuleName : string
Public ReadOnly Property RuleName As String
Property Value
The RuleName
property returns the identifier for the root rule of the referenced speech recognition grammar. The default is null
.
Examples
The following example writes information about a Grammar object to the console.
private static void DumpGrammarStatus(Grammar item)
{
Console.WriteLine("Grammar name is {0}:", item.Name);
Console.WriteLine(" The Grammar {0} loaded.",
item.Loaded ? "is" : "is not");
Console.WriteLine(" The Grammar {0} enabled.",
item.Enabled ? "is" : "is not");
if (item.RuleName != null)
{
Console.WriteLine(" The root rule is {0}.", item.RuleName);
}
else
{
Console.WriteLine(" The Grammar does not specify a root rule.");
}
}
Remarks
To construct a Grammar object and set the name for its root rule, use one of the Grammar constructors that takes the ruleName
parameter.
If the root rule of a Grammar has no name, the property returns null
.
The root rules of Grammar instances constructed from GrammarBuilder objects typically have no name, so RuleName returns null
.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기