这里是我的代码:从字典和随机项目列表中挑选随机列表并将其显示在textBlock中?
var dict = new Dictionary<string, List<string>>
{
{"AR", new List<string> {"M4A1", "M16A4", "SCAR-L", "CM901", "TYPE 95", "G36C","ACR 6", "MK14", "AK-47", "FAD"} },
{"SM", new List<string> {"MP5","UMP45","PP90M1","P90","PM-9","MP7"}},
{"LM", new List<string>{"L86 LSW","MG36", "PKP PECHENEG","MK46","M60E4"}},
{"SR", new List<string>{"BARRET .50 CAL","L118A","DRAGUNOV","AS50","RSASS","MSR"}},
{"SG", new List<string>{"USA512","KS612","SPAS-12","AA-12","STRIKER","MODEL 1887"}},
{"RS", new List<string>{"RIOT SHIELD"}}
};
我想有一个随机的项目进行随机名单在一个文本框这个字典输出。谢谢,任何帮助表示赞赏!另外,如果使Windows Phone 7与众不同,我正在开发Windows Phone 7。
[从字典中随机输入]的可能重复(http://stackoverflow.com/questions/1028136/random-entry -from-dictionary) – 2012-04-21 07:18:32