3
好有此列表:如何从阵列创建字典
object[] test;
test[0]=null;
....
test[8700]=null;
test[8701]= object[]
....
test[9431]= object[]
其中对象[]是另一个清单,要么值真/假/空
我需要此数组转换
Dictionary<int, object> dic = new Dictionary<int,object>;
或
list<Sector> sectors= new list<Sector>()
:成只包含一个列表/词典]没有空值
其中部门看起来像这样
Sector{(int)id,(List<Product>)products}
Product{(int)id}
会是怎样做到这一点的最好/最聪明的方法是什么?
在此先感谢
你的对象[]中有什么?我认为'test'是一个对象数组本身? –
什么是你的'对象测试'初始化为? –
这可能有所帮助:http://stackoverflow.com/questions/1939293/remove-null-rows-from-a-string-array-using-linq –