我用“string,int”创建了一个Dictionary。我正在尝试通过“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;
答案 0 :(得分:0)
这就是我修复它的方法:
foreach (KeyValuePair<string, int> pair in textNumber)
{
ch_Stck.Add(pair.Key.ToString());
}