Kurt
1
Q:

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
*/
0

New to Communities?

Join the community