Grammar Constructor (Stream, String, Object[])


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Initializes a new instance of the Grammar class from a Stream and specifies a root rule.

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

public Grammar(
	Stream stream,
	string ruleName,
	object[] parameters


Type: System.IO.Stream

A Stream connected to an input/output object (including files, VisualStudio Resources, and DLLs) that contains a grammar specification.

Type: System.String

The identifier of the rule to use as the entry point of the speech recognition grammar, or null to use the default root rule of the grammar description.

Type: System.Object[]

Parameters to be passed to the initialization handler specified by the OnInit property for the entry point or the root rule of the Grammar to be created. This parameter may be null.

Exception Condition

stream is connected to a grammar that:

  • Does not contain the rule specified in ruleName

  • Requires initialization parameters different from those specified in parameters

  • Contains a relative rule reference that cannot be resolved by the default base Uri rule for grammars

Parameters for an initialization handler may also be specified.

.NET Framework
Available since 3.0
Return to top