//Create New Listvarbooks=newList<String>{"The Way of Kings","Words of Radiance","Oathbringer","Rhythm of War"};
Add New Item or New List
//Create New Listvarbooks=newList<String>{"The Way of Kings","Words of Radiance","Oathbringer","Rhythm of War"};//Add new Itemsbooks.Add("Skyward");//Add item at Specific Position// List Start at 0books.Insert(0,"Mistborn");//2nd ListvarfunBooks=newList<string>{"Cradle","Mother of Learning","Poppy War"};//Add one List to anotherbooks.AddRange(funBooks);//3rd ListvarselfHelpBooks=newList<string>{"Atomic Habits","Power of Habits"};//Insert new list at startbooks.InsertRange(0,selfHelpBooks);
Remove Items from list or Remove item from specific Index
//Create New Listvarbooks=newList<String>{"The Way of Kings","Words of Radiance","Oathbringer","Rhythm of War"};//Remove Item from Listbooks.Remove("Oathbringer");//Remove First Itembooks.RemoveAt(0);//Remove Rangebooks.RemoveRange(0,1);//Remove Allbooks.Clear();
Loop Through List Items
//Create New Listvarbooks=newList<String>{"The Way of Kings","Words of Radiance","Oathbringer","Rhythm of War"};//Loop Through List Items foreach(varbookinbooks){Console.WriteLine(book);}//Loop using Indexfor(inti=0;i<books.Count;i++){Console.WriteLine(books[i]);}