SrgsDocument.Root Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur aturan SrgsDocument akar kelas.
public:
property System::Speech::Recognition::SrgsGrammar::SrgsRule ^ Root { System::Speech::Recognition::SrgsGrammar::SrgsRule ^ get(); void set(System::Speech::Recognition::SrgsGrammar::SrgsRule ^ value); };
public System.Speech.Recognition.SrgsGrammar.SrgsRule Root { get; set; }
member this.Root : System.Speech.Recognition.SrgsGrammar.SrgsRule with get, set
Public Property Root As SrgsRule
Nilai Properti
Mengembalikan aturan yang ditetapkan sebagai aturan akar dari SrgsDocument.
Contoh
Contoh berikut membuat aturan bernama winnerRule, lalu membuat SrgsDocument objek bernama document. Contoh kemudian memanggil Add metode untuk menambahkan aturan ke dokumen. Terakhir, contoh mengatur properti dokumen Root ke winnerRule, sehingga membuatnya untuk tata bahasa yang root rule ditentukan oleh SrgsDocument objek.
SrgsRule winnerRule = new SrgsRule("WorldCupWinner");
winnerRule.Scope = SrgsRuleScope.Public;
SrgsDocument document = new SrgsDocument();
document.Rules.Add(winnerRule);
document.Root = winnerRule;
Keterangan
Objek SrgsRule harus sudah ada di dokumen SrgsRulesCollection sebelum dapat diatur ke aturan akar.
Anda juga dapat mengatur aturan akar untuk SrgsDocument objek dengan menggunakan SrgsRule objek sebagai argumen ke SrgsDocument konstruktor.