RuleName Property

Microsoft Speech Platform SDK 11

Collapse imageExpand ImageCopy imageCopyHover image

Gets the identifier of the root rule or entry point rule of a Grammar instance.

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

Visual Basic (Declaration)
Public ReadOnly Property RuleName As String
	Get
Visual Basic (Usage)
Dim instance As Grammar
Dim value As String

value = instance.RuleName
C#
public string RuleName { get; }

Property Value

Type: System..::..String

The identifier of the root rule or entry point rule of a Grammar instance.

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 method returns nullNothingnullptrunita null reference (Nothing in Visual Basic).

The root rules of Grammar instances constructed from GrammarBuilder objects typically have no name, so RuleName returns nullNothingnullptrunita null reference (Nothing in Visual Basic).

Examples

The following example writes information about a Grammar object to the console.

 Copy imageCopy Code
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.");
  }
}

See Also