string[] myArr = { "Overred", "Medloy", "Xiaoguai", "Hare" };
ArraySegment<string> arrSeg = new ArraySegment<string>(myArr);
for (int i = arrSeg.Offset; i < (arrSeg.Offset + arrSeg.Count); i++)
{
MessageBox.Show(string.Format("[{0}]:{1}", i, arrSeg.Array[i]));
}
想取某个区域:
ArraySegment<String> myArrSegMid = new ArraySegment<String>(myArr, 1, 3);
则取myArr的索引从1到3的值,
转自:
http://www.cnblogs.com/chenxizhang/archive/2009/04/23/1441786.html