【发布时间】:2009-03-19 00:09:40
【问题描述】:
有一个对象是一个数组(不是数组列表或泛型),可以容纳一组任何东西......
[[One],[Two],[Three],[Four]]
想要将 [四] 移动到 [二] 的前面,例如 旧索引 = 3,新索引 = 1 所以结果是……
[[One],[Four][Two],[Three]]
在 .NET 2.0 中最有效的方法是什么? 例如
PropertyInfo oPI = ObjectType.GetProperty("MyArray", BindingFlags.Public | BindingFlags.Instance);
object ObjectToReorder = oPI.GetValue(ParentObject, null);
Array arr = ObjectToReorder as Array;
int oldIndex = 3;
int newIndex = 1;
//Need the re-ordered list still attached to the ParentObject
提前致谢
【问题讨论】: