static void Main() { LinkedList<string> todoList = new LinkedList<string>(); todoList.Add("Ana"); todoList.Add("Marya"); todoList.Add("Jasmina"); todoList.Add("Stoyanka"); todoList.Remove("Stoyanka"); Console.WriteLine("I have to todo:"); for (int i = 0; i < todoList.Count; i++) { Console.WriteLine(todoList[i]); } Console.WriteLine("Do I have to todo Pesho? " + todoList.Contains("Pesho")); }
static void Main(string[] args) { LinkedList<int> test = new LinkedList<int>(); test.Add(2); test.Add(3); test.Add(1); test.Add(5); test.Add(3); //test.RemoveAt(3); Console.WriteLine(test[2]); Console.WriteLine(test.Get(3)); Console.WriteLine(test.Count); Console.WriteLine(test.Head.Data); foreach (var item in test) { Console.WriteLine(item); } }
private static void Main(string[] args) { LinkedList<Person> plist = new LinkedList<Person>(); plist.Add(new Person("Enn", "B", 20)); plist.Add(new Person("Ann", "B", 32)); plist.Add(new Person("Re", "E", 15)); for (int i = 0; i < plist.GetSize(); i++) { Console.WriteLine(plist[i].ToString()); } Console.WriteLine(Environment.NewLine); plist.Sort(new AgeSortComparer()); for (int i = 0; i < plist.GetSize(); i++) { Console.WriteLine(plist[i].ToString()); } System.Console.ReadLine(); }