ArrayList set and arraylist set sorting
// Do not forget to reference the namespace using System when using ArrayList. collections; // first import the namespace // 01. add Method add method // tell memory, I want to store content ArrayList list = new ArrayList (); list. add ("Haha"); list. add (""); list. add ("Haha"); // 02. print the name of each person foreach (Object item in list) {Console. writeLine ("name:" item + "");} // 03. obtain the information Console separately. writeLine (list [0]); // obtain the subscript // 04. delete hehaoxi list. remove ("Haha"); // Delete (Delete content) list. removeAt (1); // Delete the Console. writeLine ("====== === After deletion ========= "); foreach (Object item in list) {Console. writeLine ("name:" + item + "");} // 05. insert to the specified position (add to append, insert to specified insert) list. insert (1, "er"); Console. writeLine ("========= after insert ======="); foreach (Object item in list) {Console. writeLine ("name:" + item + "");} // 06. judge whether or not bool flag = list is in the Set named list. contains ("er Er"); Console. writeLine (flag); // 07. modify it to the number of elements in the array: XX. length // number of elements in the Set: xx. C Ount for (int I = 0; I <list. count; I ++) {// judge whether there is, and then modify if (list. contains ("er") {// exist, modify if (list [I]. equals ("er Er") {// modify the reassignment list [I] = "Haha"; break ;}} else {Console. writeLine ("No such person, how to modify ??? ") ;}} Console. writeLine ("========= after modification ========"); foreach (Object item in list) {Console. writeLine ("name:" + item + "");}