Skip to content

Instantly share code, notes, and snippets.

@nishanc
Created Dec 12, 2021
Embed
What would you like to do?
class Program
{
static void Main(string[] args)
{
var array = new int[] { 1, 2, 3, 4, 5, 6, 7 };
foreach (var item in GetQuarterFromMiddle(array))
{
Console.WriteLine(item);
}
}
static int[] GetQuarterFromMiddle(int[] _myArray)
{
return _myArray
.Skip(_myArray.Length / 2)
.Take(_myArray.Length / 4)
.ToArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment