development:csharp:lists_and_dictionaries

C# lists and dictionaries

// List
List<string> list = new();
list.add("alpha");
list.add("beta");
if (list.Contains("alpha")) { }
list.ForEach(delegate(String val)
{
    val;
});
list.Remove("alpha");
 
// Dictionary
Dictionary<string, UInt16> dict = new();
dict["alpha"] = 1;
dict["beta"] = 2;
if (dict.ContainsKey("alpha")) { }
foreach (KeyValuePair<string, UInt16> entry in [dictionary])
{ 
    entry.Key;
    entry.Value;
}
dict.Remove("alpha");
  • development/csharp/lists_and_dictionaries.txt
  • Last modified: 2021/05/27 13:53
  • by 127.0.0.1