Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections;
- namespace ConsoleApp4
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("\n 1) Array: ");
- var FavoriteFood = new string[] { "Apple", "Cake", "Pizza", "Salad" };
- //Array.Sort(FavoriteFood);
- //Array.Resize(ref FavoriteFood, 2);
- foreach (var Food in FavoriteFood)
- {
- Console.WriteLine(Food);
- }
- Console.WriteLine("\n 2) ArrayList: ");
- ArrayList pos = new() { 1, 2, 3 };
- pos.AddRange(FavoriteFood);
- pos.Remove("Apple");
- pos.Remove("Salad");
- foreach (var p in pos)
- {
- Console.WriteLine(p);
- }
- Console.WriteLine("\n 3) List<>: ");
- List<string> FavoriteCartoons = new() { "Bojack Horseman", "The Midnight Gospel", "Harley Quinn" };
- //FavoriteCartoons.Insert(2, "Rick and Morty");
- //FavoriteCartoons.Remove("Harley Quinn");
- //FavoriteCartoons.RemoveAt(1);
- FavoriteCartoons.Sort();
- //Console.WriteLine(FavoriteCartoons[0]);
- foreach (var Cartoons in FavoriteCartoons)
- {
- Console.WriteLine(Cartoons);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement