我保存在一个资源文件中一个txt文件(*的.resx)的一些信息:保存数据由资源文件(TXT)
23,TRUNK-1,Trunk-1,,[Barry_Boehm]
24,TRUNK-2,Trunk-2,,[Barry_Boehm]
25,LEAF-1,Leaf-1,,[Barry_Boehm]
26,LEAF-2,Leaf-2,,[Barry_Boehm]
136,UDPLite,,,[RFC3828]
...和想要保存的第一和第二进入一个SortedDictionary:
23,TRUNK-1
24,TRUNK-2
25,LEAF-1
26,LEAF-2
136,UDPLite
public static SortedDictionary<UInt16, string> xTypes = new SortedDictionary<UInt16, string>();
String[] rows = Regex.Split(Resources.ProTypes.ProTypesSource, "\r\n");
foreach (var i in rows)
{
String[] words = i.Split(new[] { ',' });
...
xTypes.Add(proNumber, proName);
}
我怎么能这样做?
'xTypes.Add(UInt16.Parse(字[0]),字[1]);'? – 2014-08-28 11:44:18
我认为可能有更好/更快的解决方案。谢谢大家 :) – Stampy 2014-08-28 11:58:58