- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between a list and an array in C#?
An array stores a fixed-size sequential collection of elements of the same type, whereas list is a generic collection.
To define a List −
List<string7gt; myList = new List<string>();
To set elements in a list, you need to use the Add method −
myList.Add("Audi"); myList.Add("BMW"); myList.Add("Chevrolet"); myList.Add("Hyundai");
To define Arrays −
int[] arr = new int[5];
To initialize and set elements to Arrays −
int[] arr = new int[5] {23, 14, 11, 78, 56};
- Related Articles
- What is the difference between a python list and an array?
- What is the difference between list and dictionary in C#?
- What is the difference between List and IList in C#?
- What are the differences between a list collection and an array in C#?
- What is the difference between a class and an object in C#?
- What is the difference between an interface and a class in C#?
- What is the difference between an int and a long in C++?
- Difference Between Array and Linked List
- What is the difference between a python list and a tuple?
- What is the difference between array_merge and array + array in PHP?
- Difference between List and Array types in Kotlin
- What is the difference between an interface and an abstract class in C#?
- What is the difference between a simulator and an emulator?
- What is the difference between a conductor and an insulator?
- What is the difference Between C and C++?

Advertisements