Hello, I have 2 questions as described below:
First Question:
I have List 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.
Sachin SinghPosted Nov 15, 2020, 1:46 AM
Note :- you can also use Enumerator and MoveNext which is a lengthy process.
> Split(List source)
Answer to 2nd Question:-
Params can only be used at the time of method declartion not while calling it, params allow you to paas any no of parameters as a comma separated value.
ex
Željko PerićPosted Nov 15, 2020, 2:14 AM