I have an array statsname as
apple
X
banana
Y
Kiwi
z
I need to put apple,banana and Kiwi in an array Fruits and X,Y and Z in an array called alphabets.
Any simple C# mechanism for it please ?
I have an array statsname as
apple
X
banana
Y
Kiwi
z
I need to put apple,banana and Kiwi in an array Fruits and X,Y and Z in an array called alphabets.
Any simple C# mechanism for it please ?
If i have understood you question correctly what you want is very simple: You want put
fruits
in array offruits
and same for alphabets and they are appearing alternatively in arraystatsname
so:using only
Arrays
:Here is some working code, hopefully this will be helpfull to you:
Single LINQ:
Then you have a list of lists:
Stolen from How to get Alternate elements using Enumerable in C#