
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add Integer Values to a Chash List
To add integer values to a list in C#, use the Add() method.
Firstly, declare an integer list in C# −
List<int> list1 = new List<int>();
Now add integer values −
list1.Add(900); list1.Add(400); list1.Add(300);
Let us see the complete code −
Example
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); } } }
Advertisements