how to get a list of subset of object in c# code example
Example: how to get a subset of a list in c#
using System;
using System.Linq;
public class MainClass
{
public static void Main()
{
int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int offset = 0;
int length = 3;
var subArray = array.Skip(offset).Take(length).ToArray();
Console.WriteLine(String.Join(",", subArray));
}
}
/*
Output: 1,2,3, this will return the first elements of the array
*/