I created a array [Framework version 2.0, C# 2.0] that stores the months in a year like so
source
public readonly static string[] Months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
I am looking for a way to retrieve IEnumerable that returns a range of months from this static list. I can think of many ways but i am here to find one that makes me go wahhhhhh…
signature of the method would look something like
signature
public IEnumerable<String> GetRange(int startIndex,int endIndex);
sample I/O
startindex = 1
endindex = 10
returns months from January ,February,March upto October
note: Array.Copy is neat but the way parameters is used makes be go wacky
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.
I would like to thank every single person who put their mind to answer my question –
Thankshere is the code that worked for me using the Inhouse objects
Fetches within the range
Fetches from given index upto the end