我该如何订购索引? [英] How do I order index?
本文介绍了我该如何订购索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有很多xml文件。我希望每个都绑定它们。
我这样的xml文件样本
I have many xml files. I want bound them each by each.
Samples of my xml files like these
<Brands TopCategory="Categories" SubCategory="Models">
<Brand Id="0" Name="Brand1" />
<Brand Id="1" Name="Brand2" />
</Brands>
<Models TopCategory="Brands" SubCategory="Products, Features">
<Model Id="0" Name="Model1" />
<Model Id="1" Name="Model2" />
</Models>
<Products TopCategory="Models" SubCategory="-1">
<Product Id="0" Name="Product1" />
<Product Id="1" Name="Product2" />
</Products>
<Features TopCategory="Models" SubCategory="Features1, Features2">
<Feature Id="0" Name="Feature1" />
<Feature Id="1" Name="Feature2" />
</Features>
<Features1 TopCategory="Features" SubCategory="-1">
<Feature Id="0" Name="Feature1" />
<Feature Id="1" Name="Feature2" />
</Features>
<Features2 TopCategory="Features" SubCategory="-1">
<Feature Id="0" Name="Feature1" />
<Feature Id="1" Name="Feature2" />
</Features>
我要点这样的订单
I want order like these
Index1 = {"Brands", "Models", "Products", "-1"}
Index2 = {"Brands", "Models", "Features", "Features1", "-1"}
Index3 = {"Brands", "Models", "Features", "Features2", "-1"}
如果子类别有-1那么必须完成索引
我尝试过:
如何创建索引订单?你有什么建议吗?
谢谢
If sub category have "-1" then must finish indexing
What I have tried:
How can i create index order? do you have any sugsesstion?
Thanks
推荐答案
你可以使用Linq .OrderBy(x => x).ToArry()或数组上的Index.Sort()。
You could use Linq .OrderBy(x => x).ToArry() or Index.Sort() on the array.
这篇关于我该如何订购索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文