我正在编写一个程序来设置一个序列,其中各种对象将出现在报告中。 序列是 Excel 电子表格中的 Y 位置(单元格)。
下面是代码的演示部分。 What I want to accomplish is to have a collection, which will allow me to add multiple objects and I can get a sorted collection based on the sequence
SortedList list = new SortedList();
Header h = new Header();
h.XPos = 1;
h.name = "Header_1";
list.Add(h.XPos, h);
h = new Header();
h.XPos = 1;
h.name = "Header_2";
list.Add(h.XPos, h);
我知道 SortedList
不会允许这样,我一直在寻找替代品。我不想 排除的副本和已经尝试了 List<KeyValuePair<int, object>>
。
Thanks.