Collections in C#

You might also like

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

Presentation:

Object Oriented Programming (OOP)


Student Name: Hifazat Ali Course Instructor:
Sir Amjad Khowaja
Student ID: BCB-22S-009
Collections in C#
Topics

• Collections
• Types of Collections
• Recommendation
• Introduction to Generic Collections
• Introduction to Non Generic Collections
• Understanding Collections types with code
Collections in C#

• C# includes specialized classes that store series of values


or objects are called collections.

• A collection is a class, so you must declare an instance of the


class before you can add elements to that collection. If your
collection contains elements of only one data type, you can use one
of the classes in the System.
Types of Collections

• There are two types of collections available in C#: non-


generic collections and generic collections.

• The System.Collections namespace contains the non-


generic collection types.
• System.Collections.Generic namespace includes generic
collection types.
Reccommendation


In most cases, it is recommended to use the generic
collections because they perform faster than non-generic
collections and also minimize exceptions by giving compile-
time errors.
Generic Collections

C# includes the following generic collection classes in


the System.Collections.Generic namespace.
Non-generic Collections
Understanding Generic Collections with code
Understanding Non Generic Collections with
code
Thanks

You might also like