C LISTE ELEMENT
// Create a list
List<string> AuthorList = new List<string>();
// Add items using Add method
AuthorList.Add("Mahesh Chand");
dani.ou
// Create a list
List<string> AuthorList = new List<string>();
// Add items using Add method
AuthorList.Add("Mahesh Chand");
using System;
using System.Collections.Generic;
class Program {
static void Main(string[] args) {
//empty list
List<int> nums = new List<int>();
//add elements to list
nums.Add(63);
nums.Add(58);
nums.Add(47);
//print list
foreach (int num in nums) {
Console.WriteLine(num);
}
}
}
Run the above C# program. The three items shall be added to the list.
Output
63
58
47