C# में किसी सूची में पूर्णांक मान जोड़ने के लिए, जोड़ें () विधि का उपयोग करें।
सबसे पहले, C# में एक पूर्णांक सूची घोषित करें -
List<int> list1 = new List<int>();
अब पूर्णांक मान जोड़ें -
list1.Add(900); list1.Add(400); list1.Add(300);
आइए देखें पूरा कोड -
उदाहरण
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Demo {
public class Program {
public static void Main(String[] args) {
List<int> list1 = new List<int>();
list1.Add(900);
list1.Add(400);
list1.Add(300);
Console.WriteLine(list1.Count);
}
}
}