可能重复:
How to copy part of an array to another array in C#?复制的阵列的一部分到另一阵列
,如果我有:
string[] myArray = . . . .
这与长度为10的数组。我怎么能创建一个新的字符串数组是第一个数组的第二到第十个元素没有循环?
可能重复:
How to copy part of an array to another array in C#?复制的阵列的一部分到另一阵列
,如果我有:
string[] myArray = . . . .
这与长度为10的数组。我怎么能创建一个新的字符串数组是第一个数组的第二到第十个元素没有循环?
string[] myArray = ....
string[] copy = new string[10];
Array.Copy(myArray, 2, copy, 0, 10);
// Copies the last two elements from the Object array to the Int32 array.
Array::Copy(myObjArray, myObjArray->GetUpperBound(0) - 1, myIntArray, myIntArray->GetUpperBound(0) - 1,
查找:http://msdn.microsoft.com/en-us/library/system.array.copy%28VS.71%29.aspx
Array.Copy(myIntArray,myIntArray.GetLowerBound(0),myObjArray,myObjArray.GetLowerBound(0),1);
这是用C++编写的,而不是C#。 – 2010-07-12 05:08:03
对不起,快速审查....虽然类似的解决方案和性质。 – 2010-07-12 05:34:45
lol ...在你做完51之前刚刚找到了它......我喜欢这个功能,但是我更喜欢循环,因为我可以解决它们的需求。 – 2010-07-12 05:06:38