Я создал массив [Framework версия 2.0, C # 2.0], в котором хранятся месяцы года примерно так:
source
public readonly static string[] Months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
Я ищу способ получения IEnumerable
который возвращает range of months
из этого статического списка.Я могу придумать много способов, но я здесь, чтобы найти тот, который заставляет меня идти вахххххх ... подпись метода будет выглядеть примерно так:
подпись
public IEnumerable<String> GetRange(int startIndex,int endIndex);
пример ввода / вывода
startindex = 1
endindex = 10
returns months from January ,February,March upto October
примечание: Array.Copy
аккуратен, но способ использования параметров делает его странным
Parameters
sourceArray
The Array that contains the data to copy.
sourceIndex
A 32-bit integer that represents the index in the sourceArray at which copying begins.
destinationArray
The Array that receives the data.
destinationIndex
A 32-bit integer that represents the index in the destinationArray at which storing begins.
length
A 32-bit integer that represents the number of elements to copy.