Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
What are the differences between a list collection and an array in C#?
List collection is a generic class and can store any data types to create a list. To define a List −
List<string> l = new List<string>();
To set elements in a list, you need to use the Add method.
l.Add("One");
l.Add("Two");
l.Add("Three");
An array stores a fixed-size sequential collection of elements of the same type.
To define Arrays −
int[] arr = new int[5];
To initialize and set elements to Arrays −
int[] arr = new int[5] {4, 8,5}; Advertisements
