Microsoft.Speech:从词典中添加到选择
Microsoft.Speech: Add to Choice from Dictionary
我用 "string, int" 创建了一个字典。我目前正在尝试通过 "ch_Stk.Add".
将单词加入选项中
我怎样才能在那里输入字典?
Dictionary<string, int> textNumber = new Dictionary<string, int>();
textNumber.Add("eins", 1);
textNumber.Add("zwei", 2);
textNumber.Add("drei", 3);
textNumber.Add("vier", 4);
textNumber.Add("fünf", 5);
textNumber.Add("sechs", 6);
Choices ch_Stck = new Choices();
ch_Stck.Add( . . . .);
GrammarBuilder gb_result = new GrammarBuilder(ch_Stck);
Grammar g_result = new Grammar(gb_result);
return g_result;
我是这样修复的:
foreach (KeyValuePair<string, int> pair in textNumber)
{
ch_Stck.Add(pair.Key.ToString());
}
我用 "string, int" 创建了一个字典。我目前正在尝试通过 "ch_Stk.Add".
将单词加入选项中
我怎样才能在那里输入字典?
Dictionary<string, int> textNumber = new Dictionary<string, int>();
textNumber.Add("eins", 1);
textNumber.Add("zwei", 2);
textNumber.Add("drei", 3);
textNumber.Add("vier", 4);
textNumber.Add("fünf", 5);
textNumber.Add("sechs", 6);
Choices ch_Stck = new Choices();
ch_Stck.Add( . . . .);
GrammarBuilder gb_result = new GrammarBuilder(ch_Stck);
Grammar g_result = new Grammar(gb_result);
return g_result;
我是这样修复的:
foreach (KeyValuePair<string, int> pair in textNumber)
{
ch_Stck.Add(pair.Key.ToString());
}