I'm new to C#, I need to do the following:
I need to declare a List
List<string[]> myList = new List<string[]>();
Now the conditions and adding to the list should work as follows (in pseudo code):
for int i = 0 to N
if nNumber == 1 add string[i] to myList[0]
else to myList[1]
In the end, I would have 2 members in my list, each member having several strings.
I am not sure how I can add these strings to the members as the method List(Of T).Add inserts members to the list and I do not want this.
var myList = new List<string>[] { new List<string>(), new List<string>() };
for (int i = 0; i <= 12; i++)
{
if (i == 1)
myList.Last().Add(i.ToString());
else
myList.First().Add(i.ToString());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With