How do I transfer the items contained in one List
to another in C# without using foreach
?
For a list of elements
List lstTest = new List();
lstTest.Add("test1");
lstTest.Add("test2");
lstTest.Add("test3");
lstTest.Add("test4");
lstTest.Add("test5");
lstTest.Add("test6");
If you want to copy all the elements
List lstNew = new List();
lstNew.AddRange(lstTest);
If you want to copy the first 3 elements
List lstNew = lstTest.GetRange(0, 3);