c# loop through list
using System;
using System.Collections.Generic;
namespace forgetCode {
class program {
public static void Main() {
List<int> list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(3);
foreach (int item in list) { // Loop through List with foreach
Console.WriteLine(item);
}
for (int i = 0; i < list.Count; i++) { // Loop through List with for
Console.WriteLine(list[i]);
}
}
}
}
/*
Outputs:
1
2
3
1
2
3
*/
Also in C#:
- c# list to string
- to list c#
- string format c#
- generic repository pattern c#
- asp.net core task iactionresult
- unity set object scale
- Request.ServerVariables["HTTP_X_FORWARDED_FOR"] get only one ipaddress
- No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.'
- asp.net model display name
- exception handling c#
- roulette algorithm genetic algorithm
- unity rotation
- unity instantiate vector3
- mouseposition unity
- unity 3d mouse look script
- sqlite connection c#
- mysql executeScalar only if successful
- how to switch scenes unity
- ping with c#
- unity detect any key
- covert char[] to string C#
- wait without pause anything else unity
- c# making a folder
- unity c# is not equal to