Grammar Constructor (SrgsDocument, String, Uri, Object[])

 

Initializes a new instance of the Grammar class from an instance of SrgsDocument, and specifies the name of a rule to be the entry point to the grammar and a base URI to resolve relative references.

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

public Grammar(
	SrgsDocument srgsDocument,
	string ruleName,
	Uri baseUri,
	object[] parameters
)

Parameters

srgsDocument
Type: System.Speech.Recognition.SrgsGrammar.SrgsDocument

An instance of SrgsDocument that contains the constraints for the speech recognition grammar.

ruleName
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.

baseUri
Type: System.Uri

The base URI to use to resolve any relative rule reference in the grammar description, or null.

parameters
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
System.ArgumentException
  • Any of the parameters contain an invalid value.

  • The SrgsDocument specified by srgsDocument does not contain the rule specified in ruleName.

  • The contents of the array parameters do not match the arguments of any of the rule's initialization handlers.

  • The grammar has a relative rule reference that cannot be resolved by the default base Uri rule for grammars or the URI supplied by baseUri.

Parameters for an initialization handler may also be specified.

.NET Framework
Available since 3.0
Return to top
Show: