Set in C # (Array/ArrayList/List <T>/HashTable/Dictionary ),
Int [] numbers = new int [5]; // The length is 5 and the element type is int. String [,] names = new string [5, 4]; // a two-dimensional array of 5*4 Byte [] [] scores = new byte [5] []; // an array with a length of 5. The element is a byte array, and the length of the element array is unknown. Different formats: Int [] numbers = new int [5]; Int [] numbers2 = new [] {100,200,300,400,500 }; Int [] numbers3 ={ 100,200,300,400,500 }; |
|
System. Collections. ArrayList ArrayList al = new ArrayList (); Al. Add (5 ); Al. Add ("Hello Tom "); |
System. Collections. Generic. List <T> List <int> intList = new List <int> (); IntList. Add (1, 500 ); IntList. AddRange (new int [] {1,100 }; IntList. Insert (1, 1000 ); Cw (intList. Contains (100 )); Cw (intList. indexOf (10 )); |
System. Collections. HashTable HashTable ht = new HashTable (); Ht. Add ("name", "Tom "); Ht. Add ("age", 18 ); |
System. Collections. Generic. Dictionary Dictionary <string, string> dic = new Dictionary <string, string> (); Dic. Add ("name", "Tom "); Dic. Add ("age", "eighteen "); |