Created
December 12, 2021 13:43
-
-
Save nishanc/6d8c1e1f8a6040927bcc59f465dc6b5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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