Grammar.Loaded Property

Definition

Gets whether a Grammar has been loaded by a speech recognizer.

C#
public bool Loaded { get; }

Property Value

The Loaded property returns true if the referenced speech recognition grammar is currently loaded in a speech recognizer; otherwise the property returns false. The default is false.

Examples

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

C#
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

Once a Grammar has been loaded, the values of Weight, and Priority cannot be changed.

Applies to

Produk Versi
.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