C# Collections Tutorial With Examples

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

(/)

C# Collections Tutorial with Examples


In our previous tutorial, we have learned about how we can use arrays in C#. Let's have
a quick overview of it, Arrays in programming are used to group a set of related objects.
So one could create an array or a set of Integers, which could be accessed via one
variable name.

What is Collections in C#?


Collections are similar to Arrays, it provides a more flexible way of working with a group
of objects.

In arrays, you would have noticed that you need to define the number of elements in an
array beforehand. This had to be done when the array was declared.

But in a collection, you don't need to define the size of the collection beforehand. You can
add elements or even remove elements from the collection at any point of time. This
chapter will focus on how we can work with the different collections available in C#.

Collection Description

ArrayList (/c- The ArrayList collection is similar to the Arrays data type in C#. The
sharp- biggest difference is the dynamic nature of the array list collection.
arraylist.html)

Stack (/c-sharp- The stack is a special case collection which represents a last in first
stack.html) out (LIFO) concept

Queues (/c- The Queue is a special case collection which represents a first in
sharp- first out concept
queue.html)

Hashtable (/c- A hash table is a special collection that is used to store key-value
sharp- items
hashtable.html)

SortedList The SortedList is a collection which stores key-value pairs in the


ascending order of key by default.

BitArray A bit array is an array of data structure which stores bits

/
Report a Bug
Prev (/c-sharp-interface.html) Next (/c-sharp-arraylist.html)

YOU MIGHT LIKE:

C# C# C#

(/c-sharp-stream.html) (/c-sharp-stack.html) (/c- (/c-sharp-conditional-


(/c-sharp- sharp-stack.html) statements.html)
stream.html) (/c-sharp-
C# Stream Tutorial: C# Stack with Example conditional-
StreamReader, (/c-sharp-stack.html) statements.html)
StreamWriter with
C# IF, Switch, For, While
Example
Loop Statements Tutorial
(/c-sharp-stream.html) [Examples]
(/c-sharp-conditional-
statements.html)

C# C# C#

(/c-sharp-hashtable.html) (/c-sharp-queue.html) (/c- (/c-sharp-variables-


(/c-sharp- sharp-queue.html) operator.html) (/c-
hashtable.html) sharp-variables-
C# Hashtable with C# Queue with Examples operator.html)
Examples (/c-sharp-queue.html) C# Variables & Operators
(/c-sharp-hashtable.html) with Example
(/c-sharp-variables-
operator.html)

C# Tutorial
10) C# Class and Object (/c-sharp-class-object.html)

11) C# Access Modifiers(Specifiers) (/c-sharp-access-modifiers-constructor.html)

12) C# Inheritance & Polymorphism (/c-sharp-inheritance-polymorphism.html)

13) C# Abstract Classes (/c-sharp-abstract-class.html)

14) C# Interface (/c-sharp-interface.html)

15) C# Collections (/c-sharp-collections.html) /


16) C# ArrayList (/c-sharp-arraylist.html)

17) C# Stack with Example (/c-sharp-stack.html)

18) C# Queue (/c-sharp-queue.html)

19) C# Hashtable (/c-sharp-hashtable.html)

20) C# Windows Forms Application (/c-sharp-windows-forms-application.html)

(https://www.facebook.com/guru99com/)
(https://twitter.com/guru99com)
(https://www.linkedin.com/company/guru99/)

(https://www.youtube.com/channel/UC19i1XD6k88KqHlET8atqF

(https://forms.aweber.com/form/46/724807646.htm)

About
About Us (/about-us.html)
Advertise with Us (/advertise-us.html)
Write For Us (/become-an-instructor.html)
Contact Us (/contact-us.html)

Career Suggestion
SAP Career Suggestion Tool (/best-sap-
module.html)
Software Testing as a Career (/software-testing-
career-complete-guide.html)

Interesting
eBook (/ebook-pdf.html)
Blog (/blog/)
Quiz (/tests.html)
SAP eBook (/sap-ebook-pdf.html)

/
Execute online
Execute Java Online (/try-java-editor.html)
Execute Javascript (/execute-javascript-online.html)
Execute HTML (/execute-html-online.html)
Execute Python (/execute-python-online.html)

© Copyright - Guru99 2020


Privacy Policy (/privacy-policy.html) | Affiliate
Disclaimer (/affiliate-earning-disclaimer.html) | ToS
(/terms-of-service.html)

You might also like