List allows you to store different types of data in a Node/List
type structure, example for List<string>:
("word") --> ("word") --> ("word") --> null
every List item contains the value and the 'address' to the next list item.
Add objects by using .Add() --> list.Add("word")
output:
("word") --> ("word") --> ("word") --> ("word") --> null
List<Action> functions = new List<Action>();
functions.Add(Move);
foreach (Action func in functions)
func();
List<string> listOfString = new List<string>();
listOfString.Add("georgel");
listOfString.Add("marcel");
for (int i = 0; i < listOfString.Count; i++)
{
Console.WriteLine("the strings are: " + listOfString[i]);
}
List<User> listOfUser = new List<User>()
{
new User() { Name = "john", Age = 22 },
new User() { Name = "john", Age = 44 },
};
for (int i = 0; i < listOfUser.Count; i++)
{
Console.WriteLine("the name is: " + listOfUser[i].Name + " and the age is: " + listOfUser[i].Age);
}
//USER CLASS
class User
{
public string Name { get; set; }
public int Age { get; set; }
}
Code Example |
---|
Csharp :: asp.net core authorization default policy |
Csharp :: drop down list razor example |
Csharp :: c# compare dateTime with string |
Csharp :: Get Mac address of Device in Xamarin |
:: |
:: |
:: |
Csharp :: |
:: |
Csharp :: c# centos Regex Username |
Csharp :: c# list any retun indec |
:: |
Csharp :: cdn providers |
Csharp :: ontriggerenter2d |
Csharp :: binding on button c# |
Csharp :: |
Csharp :: Formcollection asp.net form |
:: if input.get touch |
:: |
:: |
:: |
:: |
Csharp :: select a whole row out of a 2d array C# |
Csharp :: |
Csharp :: c# copy all files in directory and subdirectories |
:: c# anonymous type as return value |
:: |
:: c# define array |
:: datetime show 24 hour format c# |
:: create a file in the directory of the exe and write to it c# |