-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
40 lines (38 loc) · 1.03 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace MyListTemplate
{
using System;
using System.Collections;
class Program
{
static void Main(string[] args)
{
MyList<int> list = new MyList<int>();
list.Add(9);
list.Add(8);
list.Add(7);
list.Add(6);
list.Add(5);
list.Add(4);
PrintList(list);
System.Console.WriteLine($"8 index is {list.IndexOf(8)}");
System.Console.WriteLine("Add 144 index 2");
list.Insert(2,144);
PrintList(list);
System.Console.WriteLine("Remove value 5");
list.Remove(5);
PrintList(list);
System.Console.WriteLine("Remove element index 4");
list.RemoveAt(4);
PrintList(list);
Console.ReadKey();
}
static void PrintList<T>(MyList<T> list)
{
foreach (var item in list)
{
System.Console.WriteLine($"Element {item}");
}
}
}
}