Export (0) Print
Expand All

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

Initializes a new instance of the Grammar class a Streamand specifies a root rule and a base URI to resolve relative references.

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

public Grammar(
	Stream stream,
	string ruleName,
	Uri baseUri,
	Object[] parameters
)

Parameters

stream
Type: System.IO.Stream

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

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.

ExceptionCondition
ArgumentException
  • Any of the parameters contain an invalid value.

  • The stream is connected to a grammar that does not contain the rule specified by ruleName.

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

  • The grammar contains 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

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft