Answers for "c# list foreach"

C#
3

c# list append

static void Main()
{
    // Add first 4 numbers to the List.
    List<int> primes = new List<int>();
    primes.Add(2);
    primes.Add(3);
    primes.Add(5);
    primes.Add(7);
}
Posted by: Guest on March-23-2020
1

c# foreach arra

int[,] numbers2D = new int[3, 2] { { 9, 99 }, { 3, 33 }, { 5, 55 } };
// Or use the short form:
// int[,] numbers2D = { { 9, 99 }, { 3, 33 }, { 5, 55 } };

foreach (int i in numbers2D)
{
    System.Console.Write("{0} ", i);
}
// Output: 9 99 3 33 5 55
Posted by: Guest on May-18-2020
1

c# ienumerable to list

List<object> list = enumerable.ToList();
Posted by: Guest on March-12-2020
1

c# list foreach

someList.ForEach(x => { if(x.RemoveMe) someList.Remove(x); });
Posted by: Guest on August-11-2020
1

c# list.foreach

List<string> someList = <some way to init>
someList.ForEach(delegate(string s) {
    <process the string>
});
Posted by: Guest on May-28-2020

C# Answers by Framework

Browse Popular Code Answers by Language