-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathSrgsDocument.xml
More file actions
873 lines (766 loc) · 57.7 KB
/
Copy pathSrgsDocument.xml
File metadata and controls
873 lines (766 loc) · 57.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
<Type Name="SrgsDocument" FullName="System.Speech.Recognition.SrgsGrammar.SrgsDocument">
<TypeSignature Language="C#" Value="public class SrgsDocument" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit SrgsDocument extends System.Object" FrameworkAlternate="net-10.0-pp;net-8.0-pp;net-9.0-pp;netframework-4.7.1-pp;netframework-4.7.2-pp;netframework-4.8.1-pp;netframework-4.8-pp;netstandard-2.0-pp" />
<TypeSignature Language="DocId" Value="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" />
<TypeSignature Language="VB.NET" Value="Public Class SrgsDocument" />
<TypeSignature Language="F#" Value="type SrgsDocument = class" />
<TypeSignature Language="C++ CLI" Value="public ref class SrgsDocument" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit SrgsDocument extends System.Object" FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.1</AssemblyVersion>
<AssemblyVersion>9.0.0.2</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Serializable]</AttributeName>
<AttributeName Language="F#">[<System.Serializable>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Defines a design-time object that is used to build strongly-typed runtime grammars that conform to the <see href="https://www.w3.org/TR/speech-grammar/">Speech Recognition Grammar Specification (SRGS) Version 1.0</see>.</summary>
<remarks>
<format type="text/markdown"><]
## Remarks
You can you construct an empty <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> instance and build a grammar by adding instances of classes that represent SRGS elements, such as <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule>, <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf>,<xref:System.Speech.Recognition.SrgsGrammar.SrgsItem>, <xref:System.Speech.Recognition.SrgsGrammar.SrgsRuleRef>, <xref:System.Speech.Recognition.SrgsGrammar.SrgsSemanticInterpretationTag>, and <xref:System.Speech.Recognition.SrgsGrammar.SrgsToken>. You can also construct an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> instance from an existing SRGS-compliant XML grammar file, from an instance of <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule>, or from an instance of <xref:System.Speech.Recognition.GrammarBuilder>.
After the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object is created, it can be loaded into a <xref:System.Speech.Recognition.Grammar> object or compiled by <xref:System.Speech.Recognition.SrgsGrammar.SrgsGrammarCompiler>, enabling it to be read by a <xref:System.Speech.Recognition.Grammar> object.
See [Create Grammars Using SrgsGrammar](https://learn.microsoft.com/previous-versions/office/developer/speech-technologies/hh361680(v%3doffice.14)) in the [System Speech Programming Guide for .NET Framework](https://learn.microsoft.com/previous-versions/office/developer/speech-technologies/hh361625(v%3doffice.14)) for more information and examples.
]]></format>
</remarks>
<altmember cref="T:System.Speech.Recognition.Grammar" />
<altmember cref="T:System.Speech.Recognition.SrgsGrammar.SrgsGrammarCompiler" />
<related type="Article" href="https://learn.microsoft.com/previous-versions/office/developer/speech-technologies/hh361680(v%3doffice.14)">Create Grammars Using SrgsGrammar</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Using the constructors for the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> class, you can create an instance of <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> from a <xref:System.Speech.Recognition.GrammarBuilder>, <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule>, or <xref:System.Xml.XmlReader> object, from a string that contains the path to an XML-format grammar, or you can initiate a blank instance of <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument>.
]]></format>
</remarks>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SrgsDocument ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Speech.Recognition.SrgsGrammar.SrgsDocument.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 SrgsDocument();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor creates an empty <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> instance. To build a grammar within an empty <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> instance, add instances of classes that represent SRGS elements, such as <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule>, <xref:System.Speech.Recognition.SrgsGrammar.SrgsRuleRef>, <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf>, and <xref:System.Speech.Recognition.SrgsGrammar.SrgsItem>.
## Examples
The following example creates an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object and then creates a public rule named `winnerRule`. It then creates an <xref:System.Speech.Recognition.SrgsGrammar.SrgsItem> that consists of the string "A nation that has won the World Cup is:", and adds this item to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule.Elements%2A> property of the rule. The example then creates two more rules (`ruleEurope` and `ruleSAmerica`), each of which is an <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf> object that contains three <xref:System.Speech.Recognition.SrgsGrammar.SrgsItem> objects. After that, another <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf> object is created that contains <xref:System.Speech.Recognition.SrgsGrammar.SrgsRuleRef> objects that refer to `ruleEurope` and `ruleSAmerica`. The new <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf> object is then added to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule.Elements%2A> property of `winnerRule`. After this, all three rules (`winnerRule`, `ruleEurope`, and `ruleSAmerica`) are added to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Rules%2A> property of <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument>. Finally, the three rules are compiled into a binary representation of the grammar.
```csharp
public void WorldSoccerWinners ()
{
// Create an SrgsDocument, create a new rule
// and set its scope to public.
SrgsDocument document = new SrgsDocument();
SrgsRule winnerRule = new SrgsRule("WorldCupWinner");
winnerRule.Scope = SrgsRuleScope.Public;
// Add the introduction.
winnerRule.Elements.Add(new SrgsItem("A nation that has won the World Cup is: "));
// Create the rule for the European nations.
SrgsOneOf oneOfEurope = new SrgsOneOf(new SrgsItem[] {new SrgsItem("England"),
new SrgsItem("France"), new SrgsItem("Germany"), new SrgsItem("Italy")});
SrgsRule ruleEurope = (new SrgsRule("EuropeanNations", new SrgsElement[] {oneOfEurope}));
// Create the rule for the South American nations.
SrgsOneOf oneOfSAmerica = new SrgsOneOf(new SrgsItem[] {new SrgsItem("Argentina"),
new SrgsItem("Brazil"), new SrgsItem("Uruguay")});
SrgsRule ruleSAmerica = (new SrgsRule("SouthAmericanNations", new SrgsElement[] {oneOfSAmerica}));
// Add references to winnerRule for ruleEurope and ruleSAmerica.
winnerRule.Elements.Add(new SrgsOneOf(new SrgsItem[] {(new SrgsItem
(new SrgsRuleRef(ruleEurope))), new SrgsItem(new SrgsRuleRef(ruleSAmerica))}));
// Add all the rules to the document and make winnerRule
// the root rule of the document.
document.Rules.Add(new SrgsRule[] {winnerRule, ruleEurope, ruleSAmerica});
document.Root = winnerRule;
String fileName = Path.GetTempFileName();
using (FileStream stream = new FileStream(fileName, FileMode.Create))
{
// Compile the grammar to a binary format.
SrgsGrammarCompiler.Compile(document, stream);
}
}
```
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SrgsDocument (System.Speech.Recognition.GrammarBuilder builder);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Speech.Recognition.GrammarBuilder builder) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Speech.Recognition.SrgsGrammar.SrgsDocument.#ctor(System.Speech.Recognition.GrammarBuilder)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (builder As GrammarBuilder)" />
<MemberSignature Language="F#" Value="new System.Speech.Recognition.SrgsGrammar.SrgsDocument : System.Speech.Recognition.GrammarBuilder -> System.Speech.Recognition.SrgsGrammar.SrgsDocument" Usage="new System.Speech.Recognition.SrgsGrammar.SrgsDocument builder" />
<MemberSignature Language="C++ CLI" Value="public:
 SrgsDocument(System::Speech::Recognition::GrammarBuilder ^ builder);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="builder" Type="System.Speech.Recognition.GrammarBuilder" />
</Parameters>
<Docs>
<param name="builder">The <see cref="T:System.Speech.Recognition.GrammarBuilder" /> object used to create the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</param>
<summary>Initializes a new instance of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class from a <see cref="T:System.Speech.Recognition.GrammarBuilder" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example builds a grammar in a <xref:System.Speech.Recognition.GrammarBuilder> instance using <xref:System.Speech.Recognition.Choices> objects. It then creates an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> from the <xref:System.Speech.Recognition.GrammarBuilder> object.
```csharp
GrammarBuilder builder = null;
// Create new Choices objects and add countries/regions, and create GrammarBuilder objects.
Choices choicesEurope = new Choices(new string[] { "England", "France", "Germany", "Italy" });
GrammarBuilder europe = new GrammarBuilder(choicesEurope);
Choices choicesSAmerica = new Choices(new string[] { "Argentina", "Brazil", "Uruguay" });
GrammarBuilder sAmerica = new GrammarBuilder(choicesSAmerica);
Choices worldCupWinnerChoices = new Choices(new GrammarBuilder[] {choicesEurope, choicesSAmerica});
// Create new GrammarBuilder from a Choices object.
builder = new GrammarBuilder(worldCupWinnerChoices);
// Create an SrgsDocument object from a GrammarBuilder object.
SrgsDocument document = new SrgsDocument(builder);
```
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="builder" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SrgsDocument (System.Speech.Recognition.SrgsGrammar.SrgsRule grammarRootRule);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Speech.Recognition.SrgsGrammar.SrgsRule grammarRootRule) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Speech.Recognition.SrgsGrammar.SrgsDocument.#ctor(System.Speech.Recognition.SrgsGrammar.SrgsRule)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (grammarRootRule As SrgsRule)" />
<MemberSignature Language="F#" Value="new System.Speech.Recognition.SrgsGrammar.SrgsDocument : System.Speech.Recognition.SrgsGrammar.SrgsRule -> System.Speech.Recognition.SrgsGrammar.SrgsDocument" Usage="new System.Speech.Recognition.SrgsGrammar.SrgsDocument grammarRootRule" />
<MemberSignature Language="C++ CLI" Value="public:
 SrgsDocument(System::Speech::Recognition::SrgsGrammar::SrgsRule ^ grammarRootRule);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="grammarRootRule" Type="System.Speech.Recognition.SrgsGrammar.SrgsRule" />
</Parameters>
<Docs>
<param name="grammarRootRule">The <see langword="root rule" /> in the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> object.</param>
<summary>Initializes a new instance of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class and specifies an <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsRule" /> object to be the root rule of the grammar.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor adds the specified rule to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection> of the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object and sets it as the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Root%2A> rule for the grammar.
## Examples
The following example creates two rules (`chooseCities` and `destCities`) for choosing origin and destination cities for a flight. The example initializes the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> instance using the `chooseCities` rule as an argument. The example writes the contents of the rules collection and the name of the root rule to the console.
```csharp
// Create a rule that contains a list of destination cities.
SrgsRule destCities = new SrgsRule("Destination");
SrgsOneOf toCities = new SrgsOneOf(new string[] { "New York", "Seattle", "Denver" });
destCities.Add(toCities);
// Create a list of origin cities and supporting phrases.
SrgsOneOf fromCities = new SrgsOneOf(new SrgsItem[] {
new SrgsItem("Dallas"), new SrgsItem("Miami"), new SrgsItem("Chicago") });
SrgsItem intro = new SrgsItem("I want to fly from");
SrgsItem to = new SrgsItem("to");
// Create the root rule of the grammar, and assemble the components.
SrgsRule chooseCities = new SrgsRule("Trip");
chooseCities.Add(intro);
chooseCities.Add(fromCities);
chooseCities.Add(to);
chooseCities.Add(new SrgsRuleRef(destCities));
// Create the SrgsDocument and specify the root rule to add.
SrgsDocument bookFlight = new SrgsDocument(chooseCities);
// Add the rule for the destination cities to the document's rule collection.
bookFlight.Rules.Add(new SrgsRule[] { destCities });
// Display the contents of the Rules collection and the name of the root rule.
foreach (SrgsRule rule in bookFlight.Rules)
{
Console.WriteLine("Rule " + rule.Id + " is in the rules collection");
}
Console.WriteLine("Root Rule " + bookFlight.Root.Id);
// Create a Grammar object and load it to the recognizer.
Grammar g = new Grammar(bookFlight);
g.Name = ("City Chooser");
recognizer.LoadGrammarAsync(g);
```
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="grammarRootRule" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SrgsDocument (string path);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string path) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Speech.Recognition.SrgsGrammar.SrgsDocument.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (path As String)" />
<MemberSignature Language="F#" Value="new System.Speech.Recognition.SrgsGrammar.SrgsDocument : string -> System.Speech.Recognition.SrgsGrammar.SrgsDocument" Usage="new System.Speech.Recognition.SrgsGrammar.SrgsDocument path" />
<MemberSignature Language="C++ CLI" Value="public:
 SrgsDocument(System::String ^ path);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="path" Type="System.String" />
</Parameters>
<Docs>
<param name="path">The location of the SRGS XML file.</param>
<summary>Initializes a new instance of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class specifying the location of the XML document that is used to fill in the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</summary>
<remarks>
<format type="text/markdown"><]
## Examples
The following example creates a new <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> from the file named "srgsDocumentFile.xml".
```csharp
string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");
SrgsDocument document = null;
if (File.Exists(srgsDocumentFile))
document = new SrgsDocument(srgsDocumentFile);
```
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="path" /> is <see langword="null" />.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="path" /> is an empty string.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SrgsDocument (System.Xml.XmlReader srgsGrammar);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Xml.XmlReader srgsGrammar) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Speech.Recognition.SrgsGrammar.SrgsDocument.#ctor(System.Xml.XmlReader)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (srgsGrammar As XmlReader)" />
<MemberSignature Language="F#" Value="new System.Speech.Recognition.SrgsGrammar.SrgsDocument : System.Xml.XmlReader -> System.Speech.Recognition.SrgsGrammar.SrgsDocument" Usage="new System.Speech.Recognition.SrgsGrammar.SrgsDocument srgsGrammar" />
<MemberSignature Language="C++ CLI" Value="public:
 SrgsDocument(System::Xml::XmlReader ^ srgsGrammar);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="srgsGrammar" Type="System.Xml.XmlReader" />
</Parameters>
<Docs>
<param name="srgsGrammar">The <see cref="T:System.Xml.XmlReader" /> object that was created with the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> XML instance.</param>
<summary>Initializes a new instance of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class from an instance of <see cref="T:System.Xml.XmlReader" /> that references an XML-format grammar file.</summary>
<remarks>
<format type="text/markdown"><]
## Examples
The following example creates a new instance of <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> from an instance of <xref:System.Xml.XmlReader> that references the file "srgsDocumentFile.xml".
```csharp
string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");
SrgsDocument document = null;
if (File.Exists(srgsDocumentFile))
{
XmlReader reader = XmlReader.Create(srgsDocumentFile);
document = new SrgsDocument(reader);
reader.Close();
}
```
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="srgsGrammar" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="AssemblyReferences">
<MemberSignature Language="C#" Value="public System.Collections.ObjectModel.Collection<string> AssemblyReferences { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.Collection`1<string> AssemblyReferences" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.AssemblyReferences" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property AssemblyReferences As Collection(Of String)" />
<MemberSignature Language="F#" Value="member this.AssemblyReferences : System.Collections.ObjectModel.Collection<string>" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.AssemblyReferences" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Collections::ObjectModel::Collection<System::String ^> ^ AssemblyReferences { System::Collections::ObjectModel::Collection<System::String ^> ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.ObjectModel.Collection<System.String></ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the assembly reference information for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</summary>
<value>The <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.AssemblyReferences" /> property returns a string collection containing a list of the assembly references.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CodeBehind">
<MemberSignature Language="C#" Value="public System.Collections.ObjectModel.Collection<string> CodeBehind { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.Collection`1<string> CodeBehind" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.CodeBehind" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property CodeBehind As Collection(Of String)" />
<MemberSignature Language="F#" Value="member this.CodeBehind : System.Collections.ObjectModel.Collection<string>" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.CodeBehind" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Collections::ObjectModel::Collection<System::String ^> ^ CodeBehind { System::Collections::ObjectModel::Collection<System::String ^> ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.ObjectModel.Collection<System.String></ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the code-behind information for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</summary>
<value>The <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.CodeBehind" /> property returns a string collection that contains a list of the code-behind documents.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Culture">
<MemberSignature Language="C#" Value="public System.Globalization.CultureInfo Culture { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Globalization.CultureInfo Culture" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Culture" />
<MemberSignature Language="VB.NET" Value="Public Property Culture As CultureInfo" />
<MemberSignature Language="F#" Value="member this.Culture : System.Globalization.CultureInfo with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Culture" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Globalization::CultureInfo ^ Culture { System::Globalization::CultureInfo ^ get(); void set(System::Globalization::CultureInfo ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Globalization.CultureInfo</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the culture information for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</summary>
<value>A <see cref="T:System.Globalization.CultureInfo" /> object that contains the current culture information for <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Microsoft Windows and the System.Speech API accept all valid language-country codes. To perform speech recognition using the language specified in the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Culture%2A> property, a speech recognition engine that supports that language-country code must be installed. The speech recognition engines that shipped with Microsoft Windows 7 work with the following language-country codes.
- en-GB. English (United Kingdom)
- en-US. English (United States)
- de-DE. German (Germany)
- es-ES. Spanish (Spain)
- fr-FR. French (France)
- ja-JP. Japanese (Japan)
- zh-CN. Chinese (China)
- zh-TW. Chinese (Taiwan)
Two-letter language codes such as "en", "fr", or "es" are also permitted.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The value being assigned to <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Culture" /> is <see langword="null" />.</exception>
<exception cref="T:System.ArgumentException">The value being assigned to <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Culture" /> is <see cref="P:System.Globalization.CultureInfo.InvariantCulture" />.</exception>
</Docs>
</Member>
<Member MemberName="Debug">
<MemberSignature Language="C#" Value="public bool Debug { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool Debug" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Debug" />
<MemberSignature Language="VB.NET" Value="Public Property Debug As Boolean" />
<MemberSignature Language="F#" Value="member this.Debug : bool with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Debug" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool Debug { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets whether line numbers should be added to inline scripts.</summary>
<value>The <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Debug" /> property returns <see langword="true" /> if line numbers should be added for debugging purposes; otherwise the property returns <see langword="false" />.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="ImportNamespaces">
<MemberSignature Language="C#" Value="public System.Collections.ObjectModel.Collection<string> ImportNamespaces { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.Collection`1<string> ImportNamespaces" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.ImportNamespaces" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property ImportNamespaces As Collection(Of String)" />
<MemberSignature Language="F#" Value="member this.ImportNamespaces : System.Collections.ObjectModel.Collection<string>" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.ImportNamespaces" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Collections::ObjectModel::Collection<System::String ^> ^ ImportNamespaces { System::Collections::ObjectModel::Collection<System::String ^> ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.ObjectModel.Collection<System.String></ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the related namespaces for the current <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</summary>
<value>The <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.ImportNamespaces" /> property returns a string collection that contains a list of the related namespaces in the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Language">
<MemberSignature Language="C#" Value="public string Language { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Language" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Language" />
<MemberSignature Language="VB.NET" Value="Public Property Language As String" />
<MemberSignature Language="F#" Value="member this.Language : string with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Language" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Language { System::String ^ get(); void set(System::String ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the programming language used for inline code in the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>The <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Language" /> property returns the programming language to which <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> is currently set.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Mode">
<MemberSignature Language="C#" Value="public System.Speech.Recognition.SrgsGrammar.SrgsGrammarMode Mode { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Speech.Recognition.SrgsGrammar.SrgsGrammarMode Mode" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Mode" />
<MemberSignature Language="VB.NET" Value="Public Property Mode As SrgsGrammarMode" />
<MemberSignature Language="F#" Value="member this.Mode : System.Speech.Recognition.SrgsGrammar.SrgsGrammarMode with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Mode" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Speech::Recognition::SrgsGrammar::SrgsGrammarMode Mode { System::Speech::Recognition::SrgsGrammar::SrgsGrammarMode get(); void set(System::Speech::Recognition::SrgsGrammar::SrgsGrammarMode value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Speech.Recognition.SrgsGrammar.SrgsGrammarMode</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the mode for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>The recognition mode of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Mode%2A> property returns a member of the <xref:System.Speech.Recognition.SrgsGrammar.SrgsGrammarMode> that determines the type of input that the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> expects. The two possible values are `Voice` for speech input, and `Dtmf` for input of dual-tone multi-frequency (DTMF) tones that are commonly associated with a telephone.
]]></format>
</remarks>
<altmember cref="T:System.Speech.Recognition.SrgsGrammar.SrgsGrammarMode" />
</Docs>
</Member>
<Member MemberName="Namespace">
<MemberSignature Language="C#" Value="public string Namespace { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Namespace" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Namespace" />
<MemberSignature Language="VB.NET" Value="Public Property Namespace As String" />
<MemberSignature Language="F#" Value="member this.Namespace : string with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Namespace" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Namespace { System::String ^ get(); void set(System::String ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the namespace of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>The <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Namespace" /> property returns the namespace for the current <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" />.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="PhoneticAlphabet">
<MemberSignature Language="C#" Value="public System.Speech.Recognition.SrgsGrammar.SrgsPhoneticAlphabet PhoneticAlphabet { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Speech.Recognition.SrgsGrammar.SrgsPhoneticAlphabet PhoneticAlphabet" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.PhoneticAlphabet" />
<MemberSignature Language="VB.NET" Value="Public Property PhoneticAlphabet As SrgsPhoneticAlphabet" />
<MemberSignature Language="F#" Value="member this.PhoneticAlphabet : System.Speech.Recognition.SrgsGrammar.SrgsPhoneticAlphabet with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.PhoneticAlphabet" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Speech::Recognition::SrgsGrammar::SrgsPhoneticAlphabet PhoneticAlphabet { System::Speech::Recognition::SrgsGrammar::SrgsPhoneticAlphabet get(); void set(System::Speech::Recognition::SrgsGrammar::SrgsPhoneticAlphabet value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Speech.Recognition.SrgsGrammar.SrgsPhoneticAlphabet</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the phonetic alphabet of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>Returns the phonetic alphabet that must be used to specify custom pronunciations in the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsToken" /> object.</value>
<remarks>
<format type="text/markdown"><) for more information.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Root">
<MemberSignature Language="C#" Value="public System.Speech.Recognition.SrgsGrammar.SrgsRule Root { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Speech.Recognition.SrgsGrammar.SrgsRule Root" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Root" />
<MemberSignature Language="VB.NET" Value="Public Property Root As SrgsRule" />
<MemberSignature Language="F#" Value="member this.Root : System.Speech.Recognition.SrgsGrammar.SrgsRule with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Root" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Speech::Recognition::SrgsGrammar::SrgsRule ^ Root { System::Speech::Recognition::SrgsGrammar::SrgsRule ^ get(); void set(System::Speech::Recognition::SrgsGrammar::SrgsRule ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Speech.Recognition.SrgsGrammar.SrgsRule</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the root rule of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>Returns the rule that is designated as the root rule of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule> object must already be in the document's <xref:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection> before it can be set to the **root rule**.
You can also set the root rule for an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object by using an <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule> object as the argument to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> constructor.
## Examples
The following example creates a rule named `winnerRule`, and then creates an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object named `document`. The example then calls the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection.Add%2A> method to add the rule to the document. Finally, the example sets the document's <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Root%2A> property to `winnerRule`, thereby making it the `root rule` for the grammar defined by the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object.
```csharp
SrgsRule winnerRule = new SrgsRule("WorldCupWinner");
winnerRule.Scope = SrgsRuleScope.Public;
SrgsDocument document = new SrgsDocument();
document.Rules.Add(winnerRule);
document.Root = winnerRule;
```
]]></format>
</remarks>
<altmember cref="T:System.Speech.Recognition.SrgsGrammar.SrgsRule" />
</Docs>
</Member>
<Member MemberName="Rules">
<MemberSignature Language="C#" Value="public System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection Rules { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection Rules" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Rules" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Rules As SrgsRulesCollection" />
<MemberSignature Language="F#" Value="member this.Rules : System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Rules" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Speech::Recognition::SrgsGrammar::SrgsRulesCollection ^ Rules { System::Speech::Recognition::SrgsGrammar::SrgsRulesCollection ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the collection of rules that are currently defined for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>Returns the rules defined for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> object.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can add <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule> objects to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection> by using the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection.Add%2A> method on the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Rules%2A> property. If you initialize an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object and specify an <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule> object as the argument, the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule> is automatically added to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection> for the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument>.
## Examples
The following example creates a grammar that recognizes the phrase "A nation that has won the World Cup is" followed by the name of a country/region that has won the World Cup. The example creates an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object, and then creates a public rule named `winnerRule`. After adding a string to the rule `winnerRule`, the example creates two more rules (`ruleEurope` and `ruleSAmerica`), each containing a list of countries/regions. Using the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection.Add%2A> method, the example adds all three rules (`winnerRule`, `ruleEurope`, and `ruleSAmerica`) to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Rules%2A> property of the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument>.
```csharp
public void WorldSoccerWinners ()
{
// Create an SrgsDocument, create a new rule
// and set its scope to public.
SrgsDocument document = new SrgsDocument();
SrgsRule winnerRule = new SrgsRule("WorldCupWinner");
winnerRule.Scope = SrgsRuleScope.Public;
// Add the introduction.
winnerRule.Elements.Add(new SrgsItem("A nation that has won the World Cup is: "));
// Create the rule for the European nations.
SrgsOneOf oneOfEurope = new SrgsOneOf(new SrgsItem[] {new SrgsItem("England"),
new SrgsItem("France"), new SrgsItem("Germany"), new SrgsItem("Italy")});
SrgsRule ruleEurope = (new SrgsRule("EuropeanNations", new SrgsElement[] {oneOfEurope}));
// Create the rule for the South American nations.
SrgsOneOf oneOfSAmerica = new SrgsOneOf(new SrgsItem[] {new SrgsItem("Argentina"),
new SrgsItem("Brazil"), new SrgsItem("Uruguay")});
SrgsRule ruleSAmerica = (new SrgsRule("SouthAmericanNations", new SrgsElement[] {oneOfSAmerica}));
// Add references to winnerRule for ruleEurope and ruleSAmerica.
winnerRule.Elements.Add(new SrgsOneOf(new SrgsItem[] {(new SrgsItem
(new SrgsRuleRef(ruleEurope))), new SrgsItem(new SrgsRuleRef(ruleSAmerica))}));
// Add all the rules to the document and make winnerRule
// the root rule of the document.
document.Rules.Add(new SrgsRule[] {winnerRule, ruleEurope, ruleSAmerica});
document.Root = winnerRule;
}
```
]]></format>
</remarks>
<altmember cref="T:System.Speech.Recognition.SrgsGrammar.SrgsRulesCollection" />
</Docs>
</Member>
<Member MemberName="Script">
<MemberSignature Language="C#" Value="public string Script { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Script" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Script" />
<MemberSignature Language="VB.NET" Value="Public Property Script As String" />
<MemberSignature Language="F#" Value="member this.Script : string with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.Script" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Script { System::String ^ get(); void set(System::String ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the .NET scripting language for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>The <see langword="Script" /> property returns the current .NET scripting language for the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> This property has been deprecated. Its use is no longer recommended.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">An attempt is made to set the <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Script" /> property to null.</exception>
<exception cref="T:System.ArgumentException">An attempt is made to set the <see cref="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Script" /> property to an empty string.</exception>
</Docs>
</Member>
<Member MemberName="WriteSrgs">
<MemberSignature Language="C#" Value="public void WriteSrgs (System.Xml.XmlWriter srgsGrammar);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void WriteSrgs(class System.Xml.XmlWriter srgsGrammar) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Speech.Recognition.SrgsGrammar.SrgsDocument.WriteSrgs(System.Xml.XmlWriter)" />
<MemberSignature Language="VB.NET" Value="Public Sub WriteSrgs (srgsGrammar As XmlWriter)" />
<MemberSignature Language="F#" Value="member this.WriteSrgs : System.Xml.XmlWriter -> unit" Usage="srgsDocument.WriteSrgs srgsGrammar" />
<MemberSignature Language="C++ CLI" Value="public:
 void WriteSrgs(System::Xml::XmlWriter ^ srgsGrammar);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="srgsGrammar" Type="System.Xml.XmlWriter" />
</Parameters>
<Docs>
<param name="srgsGrammar">The <see cref="T:System.Xml.XmlWriter" /> that is used to write the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> instance.</param>
<summary>Writes the contents of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> object to an XML-format grammar file that conforms to the <see href="https://go.microsoft.com/fwlink/?LinkId=201761">Speech Recognition Grammar Specification (SRGS) Version 1.0</see>.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example creates an <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> object, and then creates a public rule named `winnerRule`. It then creates an <xref:System.Speech.Recognition.SrgsGrammar.SrgsItem> that consists of the string "A nation that has won the World Cup is:", and adds this item to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule.Elements%2A> property of the rule. The example then creates two more rules (`ruleEurope` and `ruleSAmerica`), each of which is an <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf> object that contains three <xref:System.Speech.Recognition.SrgsGrammar.SrgsItem> objects. After that, another <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf> object is created that contains <xref:System.Speech.Recognition.SrgsGrammar.SrgsRuleRef> objects that refer to `ruleEurope` and `ruleSAmerica`. The new <xref:System.Speech.Recognition.SrgsGrammar.SrgsOneOf> object is then added to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsRule.Elements%2A> property of `winnerRule`. After this, all three rules (`winnerRule`, `ruleEurope`, and `ruleSAmerica`) are added to the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.Rules%2A> property of the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument>. Finally, the example creates an empty XML file and an instance of <xref:System.Xml.XmlWriter>. The <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument.WriteSrgs%2A> method uses the <xref:System.Xml.XmlWriter> instance to write the contents of the <xref:System.Speech.Recognition.SrgsGrammar.SrgsDocument> to the XML file.
```csharp
public void WorldSoccerWinners ()
{
// Create an SrgsDocument, create a new rule
// and set its scope to public.
SrgsDocument document = new SrgsDocument();
SrgsRule winnerRule = new SrgsRule("WorldCupWinner");
winnerRule.Scope = SrgsRuleScope.Public;
// Add the introduction.
winnerRule.Elements.Add(new SrgsItem("A nation that has won the World Cup is: "));
// Create the rule for the European nations.
SrgsOneOf oneOfEurope = new SrgsOneOf(new SrgsItem[] {new SrgsItem("England"),
new SrgsItem("France"), new SrgsItem("Germany"), new SrgsItem("Italy")});
SrgsRule ruleEurope = (new SrgsRule("EuropeanNations", new SrgsElement[] {oneOfEurope}));
// Create the rule for the South American nations.
SrgsOneOf oneOfSAmerica = new SrgsOneOf(new SrgsItem[] {new SrgsItem("Argentina"),
new SrgsItem("Brazil"), new SrgsItem("Uruguay")});
SrgsRule ruleSAmerica = (new SrgsRule("SouthAmericanNations", new SrgsElement[] {oneOfSAmerica}));
// Add references to winnerRule for ruleEurope and ruleSAmerica.
winnerRule.Elements.Add(new SrgsOneOf(new SrgsItem[] {(new SrgsItem
(new SrgsRuleRef(ruleEurope))), new SrgsItem(new SrgsRuleRef(ruleSAmerica))}));
// Add all the rules to the document and make winnerRule
// the root rule of the document.
document.Rules.Add(new SrgsRule[] {winnerRule, ruleEurope, ruleSAmerica});
document.Root = winnerRule;
// Create a string object with the path to the file to use.
string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");
// Create an XmlWriter object and pass the file path.
XmlWriter writer = XmlWriter.Create(srgsDocumentFile);
// Write the contents of the XmlWriter object to an SRGS-compatible XML file.
document.WriteSrgs(writer);
writer.Close();
}
```
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="srgsGrammar" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="XmlBase">
<MemberSignature Language="C#" Value="public Uri XmlBase { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Uri XmlBase" />
<MemberSignature Language="DocId" Value="P:System.Speech.Recognition.SrgsGrammar.SrgsDocument.XmlBase" />
<MemberSignature Language="VB.NET" Value="Public Property XmlBase As Uri" />
<MemberSignature Language="F#" Value="member this.XmlBase : Uri with get, set" Usage="System.Speech.Recognition.SrgsGrammar.SrgsDocument.XmlBase" />
<MemberSignature Language="C++ CLI" Value="public:
 property Uri ^ XmlBase { Uri ^ get(); void set(Uri ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Speech</AssemblyName>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Uri</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the base URI of the <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" /> class.</summary>
<value>The current base URI of <see cref="T:System.Speech.Recognition.SrgsGrammar.SrgsDocument" />.</value>
<remarks>
<format type="text/markdown"><]
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>