harish reddy

harish reddy

  • NA
  • 11
  • 1.6k

List and Params Keyword Queries

Nov 15 2020 1:32 AM
Hello, I have 2 questions as described below:
First Question:
I have List<int> with a Variable named "Integers" which contain 1,2,3,4,5,6,7,8,9.
My requirement now is to store the set of 3 integers of the list in to either a new List or Array. Pls let me know how can i read the elements of the list and keep storing them in to a new list or array?
i should be able to store the first 3 elements in to a new list or array. The next 3 elements in to other list. The last 3 elements in to other list. Pls guide.
Second Question:
char[] c = { ',',':' };
string[] splittedStrings = item.Split(c);
In the above line, while writing the code,i was thinking it should be string[] splittedStrings = item.Split( params c). But writing "Params" in the arguemt is gving me the error. Pls guide why? In the VS it was showing (Params Char[] Seperator), hence the question. Pls guide.

Answers (2)