1. List <t>
To determine whether it is null: The Count attribute;
Determine whether an element is in the list: List. Contains (T item );
Traversal can be used: foreach,;
List clear: List. Clear ();
2. dictionary <T1, T2>
To determine whether it is null: The Count attribute;
Traversal can be used:
// Keyvaluepair <t, k>
Foreach (keyvaluepair <string, int> kV in List)
{
Console. writeline (Kv. Key + kv. value );
}
// Version 3.0 or later
Foreach (VAR item in List)
{
Console. writeline (item. Key + item. value );
}
// Obtain from the key set
Foreach (string key in list. Keys)
{
Console. writeline (Key + list [Key]);
}
// Direct value
Foreach (INT Val in list. values)
{
Console. writeline (VAL );
}
// You must use the for method.
List <string> test = new list <string> (list. Keys );
For (INT I = 0; I <list. Count; I ++)
{
Console. writeline (test [I] + list [test [I]);
}