-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab10.cs
33 lines (28 loc) · 851 Bytes
/
lab10.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
using System;
using System.Collections; // For non-generic collections
using System.Collections.Generic; // For generic collections
class Program
{
static void Main(string[] args)
{
// Non-generic collection (ArrayList)
ArrayList arrayList = new ArrayList();
arrayList.Add("apple");
arrayList.Add("banana");
foreach (var item in arrayList)
{
Console.WriteLine(item);
}
// Generic collection (List<T>)
List<int> list = new List<int>();
list.Add(1);
list.Add(2);
foreach (var item in list)
{
Console.WriteLine(item);
}
Console.WriteLine("Lab No: 10");
Console.WriteLine("Name: Nirajan Bhattarai");
Console.WriteLine("Roll No.: 13");
}
}