有一个对象是数组(不是ArrayList或泛型),可以容纳任何一组东西...
[[One],[Two],[Three],[Four]]
想要将 [Four] 移动至 [Two] 的前面,例如: oldIndex = 3,newIndex = 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
谢谢提前帮助。
MoveWithinArrayInOneSpecificCase(...)
。例如,如果我们尝试将一个元素从前面移动到后面,我们会得到负的“length”参数(这种方法中可能出现的错误之一)。 - Whyser