Zebra0.com

csharp arrays


Text of video
// Comparison of array and list
string[] months = { "January", "February", "March", "April",
    "May", "June", "July", "August", "September", "October",
    "November", "December" };
this.Text = months[1];
this.Text = "" + months.Min();
this.Text = months.ElementAt(1);

List<string> robots = new List<string> { };
robots.Add("R2D2");
robots.Add("Voltron");
robots.Add("C3P0");
robots.Remove("Voltron");

List<string> cars = new List<string> { "Toyota", "Ford", "Jeep" };
cars.Add("VW");
// cars.Sort();
this.Text = cars.First();
this.Text = cars.ElementAt(1);
this.Text = cars[1];

End of lesson, Next lesson: Dialogs in C#