SlideShare a Scribd company logo
A collection — sometimes called a container — is simply an object 
that groups multiple elements into a single unit. 
Collection classes are specialized classes for data storage and 
retrieval. These classes provide support for stacks, queues, lists, and 
hash tables. 
Collection classes serve various purposes, such as allocating 
memory dynamically to elements and accessing a list of items on the 
basis of an index etc. These classes create collections of objects of 
the Object class, which is the base class for all data types in C#.
Dot Net Collections are divided into 2types: 
1. NormalCollections 
2. Generic Collections 
 Normal Collections are representing with a namespace called 
System.Collections; 
 Generic Collections are representing with a namespace called 
System.Collection.Generic;
Generics 
Generics are the most powerful feature of C# Generics 
allow you to define type-safe data structures, without 
committing to actual data types. 
This results in a significant performance boost and higher 
quality code, because you get to reuse data processing 
algorithms without duplicating type-specific code.
Collections 
• Normal Collections 
1. Stack 
2. Queue 
3. ArrayList 
4. HashTable 
5. Sorted 
6. Bit Array 
• Generic Collections 
1. Stack<T> 
2. Queue<T> 
3. List<T> 
4. Dictionary<T>
Stack: 
Stack<Data type> name = new Stack<Data type>(); 
Queue: 
Queue <Data type> name = new Queue <Data type>(); 
ArrayList or List: 
ArrayList <Data type> name = new ArrayList <Data type>(); 
HashTable or Dictionary: 
HashTable <Data type, Data type> name= new 
HashTable<Data type, Data type>(); 
BitArray: 
BitSet<Data type> bs = new BitSet(); 
Data type Get[data type, Index]; 
These are the some of important collection classes in the 
collections Namespace
Generics - Prototype 
class Stack<T> 
{ 
T[ ] data; 
void Push(T top) { …} 
T Pop() { … } 
} 
Stack<string> ss = new Stack<string>; 
ss.Push(“Hello”); 
Stack<int> si = new Stack<int>; 
ss.Push(4);
Iterating over a Collection 
foreach(object o in collection) { 
// do something with o 
} 
foreach(int i in array) { 
// do something with i 
} 
 Collection objects have a GetEnumerator() method 
which returns an Enumerator object. 
 An Enumerator object has a MoveNext method and a 
Current property.
IEnumerable 
Collections in .NET use the Iterator Design Pattern, hence 
they do not implement IEnumerator. 
Instead they implement IEnumerable. 
Creates a new instance of an IEnumerator and returns it. 
public interface IEnumerable { 
IEnumerator GetEnumerator(); 
}
Enumerable Collections 
What collections are enumerable? 
That is, support the IEnumerable or IEnumerable<T> interfaces? 
System.Array – all arrays support IEnumerable<T> 
All .NET collections except dictionaries. 
System.String or string. 
Any user-defined class supporting the interface.
Collection-Drawbacks 
No type checking enforcement at compile time 
Doesn’t prevent adding unwanted types 
Can lead to difficult to troubleshoot issues 
Runtime errors! 
All items are stored as objects 
Must be cast going in and coming out 
Performance overhead of boxing and unboxing 
specific types
 collections

More Related Content

What's hot

Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loops
sangrampatil81
 
Array in C
Array in CArray in C
Array in C
Kamal Acharya
 
Array vs array list
Array vs array listArray vs array list
Array vs array list
Ravi Shetye
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
Muzamil Hussain
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Hoang Nguyen
 
Algorithm and Data Structure - Array and Struct
Algorithm and Data Structure - Array and StructAlgorithm and Data Structure - Array and Struct
Algorithm and Data Structure - Array and Struct
AndiNurkholis1
 
ArrayList in JAVA
ArrayList in JAVAArrayList in JAVA
ArrayList in JAVA
SAGARDAVE29
 
بيانات الدولة 1
بيانات الدولة 1بيانات الدولة 1
بيانات الدولة 1
Omar Computer Teacher
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
karthikeyanC40
 
Slide 1.-datastructure
Slide 1.-datastructureSlide 1.-datastructure
Slide 1.-datastructure
Minhaz Leo
 
Arrays in C
Arrays in CArrays in C
Arrays in C
sangrampatil81
 
Arrays declartion and initialization
Arrays declartion and initializationArrays declartion and initialization
Arrays declartion and initialization
sangrampatil81
 
Matlab Organizing Data
Matlab Organizing DataMatlab Organizing Data
Matlab Organizing Data
DataminingTools Inc
 
12. arrays
12. arrays12. arrays
Quick dive to pandas
Quick dive to pandasQuick dive to pandas
Quick dive to pandas
Robin Kiplangat
 
Data structure Assignment Help
Data structure Assignment HelpData structure Assignment Help
Data structure Assignment Help
JosephErin
 
introduction to Data Structure and classification
 introduction to Data Structure and classification introduction to Data Structure and classification
introduction to Data Structure and classification
chauhankapil
 
Arrays in c
Arrays in cArrays in c
Arrays in c
AnIsh Kumar
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
Self-Employed
 
7.basic array
7.basic array7.basic array
7.basic array
Mir Riyanul Islam
 

What's hot (20)

Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loops
 
Array in C
Array in CArray in C
Array in C
 
Array vs array list
Array vs array listArray vs array list
Array vs array list
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Algorithm and Data Structure - Array and Struct
Algorithm and Data Structure - Array and StructAlgorithm and Data Structure - Array and Struct
Algorithm and Data Structure - Array and Struct
 
ArrayList in JAVA
ArrayList in JAVAArrayList in JAVA
ArrayList in JAVA
 
بيانات الدولة 1
بيانات الدولة 1بيانات الدولة 1
بيانات الدولة 1
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Slide 1.-datastructure
Slide 1.-datastructureSlide 1.-datastructure
Slide 1.-datastructure
 
Arrays in C
Arrays in CArrays in C
Arrays in C
 
Arrays declartion and initialization
Arrays declartion and initializationArrays declartion and initialization
Arrays declartion and initialization
 
Matlab Organizing Data
Matlab Organizing DataMatlab Organizing Data
Matlab Organizing Data
 
12. arrays
12. arrays12. arrays
12. arrays
 
Quick dive to pandas
Quick dive to pandasQuick dive to pandas
Quick dive to pandas
 
Data structure Assignment Help
Data structure Assignment HelpData structure Assignment Help
Data structure Assignment Help
 
introduction to Data Structure and classification
 introduction to Data Structure and classification introduction to Data Structure and classification
introduction to Data Structure and classification
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
 
7.basic array
7.basic array7.basic array
7.basic array
 

Viewers also liked

C#4.0 features
C#4.0 featuresC#4.0 features
exception handling
 exception handling exception handling
exception handling
Yaswanth Babu Gummadivelli
 
Bill Gates
Bill GatesBill Gates
multi threading
multi threadingmulti threading
use case diagramHospital managment system
use case diagramHospital managment systemuse case diagramHospital managment system
use case diagramHospital managment system
Yaswanth Babu Gummadivelli
 
business analyst interview questions and answers
business analyst interview questions and answersbusiness analyst interview questions and answers
business analyst interview questions and answers
Congress Man
 
Requirements elicitation
Requirements elicitationRequirements elicitation
Requirements elicitation
Abdul Basit
 
Usecase diagram railway reservation system
Usecase diagram railway reservation systemUsecase diagram railway reservation system
Usecase diagram railway reservation systemmuthumeenakshim
 
Generics collections
Generics collectionsGenerics collections
Generics collections
Yaswanth Babu Gummadivelli
 
Business analyst interview questions and answers
Business analyst interview questions and answersBusiness analyst interview questions and answers
Business analyst interview questions and answers
Robin G
 
Use of ict tools for teaching –learning
Use of ict tools for teaching –learningUse of ict tools for teaching –learning
Use of ict tools for teaching –learning
Venkat Srinivasan
 
Use Case Modeling
Use Case ModelingUse Case Modeling
Use Case Modeling
Venkat Srinivasan
 
Business Analyst Training
Business  Analyst  TrainingBusiness  Analyst  Training
Business Analyst Training
Craig Brown
 
Business Analysis Fundamentals
Business Analysis FundamentalsBusiness Analysis Fundamentals
Business Analysis Fundamentals
waelsaid75
 
Business analyst ppt
Business analyst pptBusiness analyst ppt
Business analyst ppt
Yaswanth Babu Gummadivelli
 
Business analysis interview question and answers
Business analysis interview question and answersBusiness analysis interview question and answers
Business analysis interview question and answers
Garuda Trainings
 
85 business analyst interview questions and answers
85 business analyst interview questions and answers85 business analyst interview questions and answers
85 business analyst interview questions and answers
BusinessAnalyst247
 

Viewers also liked (17)

C#4.0 features
C#4.0 featuresC#4.0 features
C#4.0 features
 
exception handling
 exception handling exception handling
exception handling
 
Bill Gates
Bill GatesBill Gates
Bill Gates
 
multi threading
multi threadingmulti threading
multi threading
 
use case diagramHospital managment system
use case diagramHospital managment systemuse case diagramHospital managment system
use case diagramHospital managment system
 
business analyst interview questions and answers
business analyst interview questions and answersbusiness analyst interview questions and answers
business analyst interview questions and answers
 
Requirements elicitation
Requirements elicitationRequirements elicitation
Requirements elicitation
 
Usecase diagram railway reservation system
Usecase diagram railway reservation systemUsecase diagram railway reservation system
Usecase diagram railway reservation system
 
Generics collections
Generics collectionsGenerics collections
Generics collections
 
Business analyst interview questions and answers
Business analyst interview questions and answersBusiness analyst interview questions and answers
Business analyst interview questions and answers
 
Use of ict tools for teaching –learning
Use of ict tools for teaching –learningUse of ict tools for teaching –learning
Use of ict tools for teaching –learning
 
Use Case Modeling
Use Case ModelingUse Case Modeling
Use Case Modeling
 
Business Analyst Training
Business  Analyst  TrainingBusiness  Analyst  Training
Business Analyst Training
 
Business Analysis Fundamentals
Business Analysis FundamentalsBusiness Analysis Fundamentals
Business Analysis Fundamentals
 
Business analyst ppt
Business analyst pptBusiness analyst ppt
Business analyst ppt
 
Business analysis interview question and answers
Business analysis interview question and answersBusiness analysis interview question and answers
Business analysis interview question and answers
 
85 business analyst interview questions and answers
85 business analyst interview questions and answers85 business analyst interview questions and answers
85 business analyst interview questions and answers
 

Similar to collections

Collections generic
Collections genericCollections generic
Collections generic
sandhish
 
Generic Programming &amp; Collection
Generic Programming &amp; CollectionGeneric Programming &amp; Collection
Generic Programming &amp; Collection
Arya
 
Generic Programming &amp; Collection
Generic Programming &amp; CollectionGeneric Programming &amp; Collection
Generic Programming &amp; Collection
Arya
 
Net framework session02
Net framework session02Net framework session02
Net framework session02
Vivek chan
 
Generics Collections
Generics CollectionsGenerics Collections
Generics Collections
phanleson
 
Collections
CollectionsCollections
Collections
sagsharma
 
Collections in .net technology (2160711)
Collections in .net technology (2160711)Collections in .net technology (2160711)
Collections in .net technology (2160711)
Janki Shah
 
Collections and its types in C# (with examples)
Collections and its types in C# (with examples)Collections and its types in C# (with examples)
Collections and its types in C# (with examples)
Aijaz Ali Abro
 
C# p9
C# p9C# p9
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
GauravPatil318
 
Java Collections Tutorials
Java Collections TutorialsJava Collections Tutorials
Java Collections Tutorials
Prof. Erwin Globio
 
Collections in Java
Collections in JavaCollections in Java
Collections in Java
Khasim Cise
 
LectureNotes-03-DSA
LectureNotes-03-DSALectureNotes-03-DSA
LectureNotes-03-DSA
Haitham El-Ghareeb
 
collections
collectionscollections
collections
javeed_mhd
 
Array list(1)
Array list(1)Array list(1)
Array list(1)
abdullah619
 
Collections
CollectionsCollections
Collections
Manav Prasad
 
Collections
CollectionsCollections
Collections
Rajkattamuri
 
Collection
CollectionCollection
Collection
Gayathri Ganesh
 
Collections
CollectionsCollections
Collections
niksomer
 
C# Non generics collection
C# Non generics collectionC# Non generics collection
C# Non generics collection
Prem Kumar Badri
 

Similar to collections (20)

Collections generic
Collections genericCollections generic
Collections generic
 
Generic Programming &amp; Collection
Generic Programming &amp; CollectionGeneric Programming &amp; Collection
Generic Programming &amp; Collection
 
Generic Programming &amp; Collection
Generic Programming &amp; CollectionGeneric Programming &amp; Collection
Generic Programming &amp; Collection
 
Net framework session02
Net framework session02Net framework session02
Net framework session02
 
Generics Collections
Generics CollectionsGenerics Collections
Generics Collections
 
Collections
CollectionsCollections
Collections
 
Collections in .net technology (2160711)
Collections in .net technology (2160711)Collections in .net technology (2160711)
Collections in .net technology (2160711)
 
Collections and its types in C# (with examples)
Collections and its types in C# (with examples)Collections and its types in C# (with examples)
Collections and its types in C# (with examples)
 
C# p9
C# p9C# p9
C# p9
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
Java Collections Tutorials
Java Collections TutorialsJava Collections Tutorials
Java Collections Tutorials
 
Collections in Java
Collections in JavaCollections in Java
Collections in Java
 
LectureNotes-03-DSA
LectureNotes-03-DSALectureNotes-03-DSA
LectureNotes-03-DSA
 
collections
collectionscollections
collections
 
Array list(1)
Array list(1)Array list(1)
Array list(1)
 
Collections
CollectionsCollections
Collections
 
Collections
CollectionsCollections
Collections
 
Collection
CollectionCollection
Collection
 
Collections
CollectionsCollections
Collections
 
C# Non generics collection
C# Non generics collectionC# Non generics collection
C# Non generics collection
 

More from Yaswanth Babu Gummadivelli

Presentation on BA
Presentation on BAPresentation on BA
Presentation on BA
Yaswanth Babu Gummadivelli
 
Ba -content
Ba -contentBa -content
E commerce use case documentation.
E commerce use case documentation.E commerce use case documentation.
E commerce use case documentation.
Yaswanth Babu Gummadivelli
 
MOM on activity diagram
MOM on activity diagramMOM on activity diagram
MOM on activity diagram
Yaswanth Babu Gummadivelli
 
UML Diagrams
UML DiagramsUML Diagrams
MOM on BA
MOM on BAMOM on BA
Constructors
Constructors Constructors
array
array array
Use case for atm
Use case for atmUse case for atm
Use case for atm
Yaswanth Babu Gummadivelli
 
Activity diagram for ticket vending machine
Activity diagram for ticket vending machineActivity diagram for ticket vending machine
Activity diagram for ticket vending machine
Yaswanth Babu Gummadivelli
 
Extreme programming
Extreme programmingExtreme programming
Extreme programming
Yaswanth Babu Gummadivelli
 
Agile model
Agile model Agile model
Business Analyst
Business AnalystBusiness Analyst
Business Analyst
Yaswanth Babu Gummadivelli
 
CRM and ERP
CRM and ERPCRM and ERP
Reflection
ReflectionReflection
Exceptions in SQL Server
Exceptions in SQL ServerExceptions in SQL Server
Exceptions in SQL Server
Yaswanth Babu Gummadivelli
 
Views
ViewsViews
Triggers
TriggersTriggers
Subqueries
SubqueriesSubqueries

More from Yaswanth Babu Gummadivelli (20)

Presentation on BA
Presentation on BAPresentation on BA
Presentation on BA
 
ERP
ERPERP
ERP
 
Ba -content
Ba -contentBa -content
Ba -content
 
E commerce use case documentation.
E commerce use case documentation.E commerce use case documentation.
E commerce use case documentation.
 
MOM on activity diagram
MOM on activity diagramMOM on activity diagram
MOM on activity diagram
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
MOM on BA
MOM on BAMOM on BA
MOM on BA
 
Constructors
Constructors Constructors
Constructors
 
array
array array
array
 
Use case for atm
Use case for atmUse case for atm
Use case for atm
 
Activity diagram for ticket vending machine
Activity diagram for ticket vending machineActivity diagram for ticket vending machine
Activity diagram for ticket vending machine
 
Extreme programming
Extreme programmingExtreme programming
Extreme programming
 
Agile model
Agile model Agile model
Agile model
 
Business Analyst
Business AnalystBusiness Analyst
Business Analyst
 
CRM and ERP
CRM and ERPCRM and ERP
CRM and ERP
 
Reflection
ReflectionReflection
Reflection
 
Exceptions in SQL Server
Exceptions in SQL ServerExceptions in SQL Server
Exceptions in SQL Server
 
Views
ViewsViews
Views
 
Triggers
TriggersTriggers
Triggers
 
Subqueries
SubqueriesSubqueries
Subqueries
 

Recently uploaded

BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
EduSkills OECD
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 

Recently uploaded (20)

BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 

collections

  • 1. A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collection classes are specialized classes for data storage and retrieval. These classes provide support for stacks, queues, lists, and hash tables. Collection classes serve various purposes, such as allocating memory dynamically to elements and accessing a list of items on the basis of an index etc. These classes create collections of objects of the Object class, which is the base class for all data types in C#.
  • 2. Dot Net Collections are divided into 2types: 1. NormalCollections 2. Generic Collections  Normal Collections are representing with a namespace called System.Collections;  Generic Collections are representing with a namespace called System.Collection.Generic;
  • 3. Generics Generics are the most powerful feature of C# Generics allow you to define type-safe data structures, without committing to actual data types. This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code.
  • 4. Collections • Normal Collections 1. Stack 2. Queue 3. ArrayList 4. HashTable 5. Sorted 6. Bit Array • Generic Collections 1. Stack<T> 2. Queue<T> 3. List<T> 4. Dictionary<T>
  • 5. Stack: Stack<Data type> name = new Stack<Data type>(); Queue: Queue <Data type> name = new Queue <Data type>(); ArrayList or List: ArrayList <Data type> name = new ArrayList <Data type>(); HashTable or Dictionary: HashTable <Data type, Data type> name= new HashTable<Data type, Data type>(); BitArray: BitSet<Data type> bs = new BitSet(); Data type Get[data type, Index]; These are the some of important collection classes in the collections Namespace
  • 6. Generics - Prototype class Stack<T> { T[ ] data; void Push(T top) { …} T Pop() { … } } Stack<string> ss = new Stack<string>; ss.Push(“Hello”); Stack<int> si = new Stack<int>; ss.Push(4);
  • 7. Iterating over a Collection foreach(object o in collection) { // do something with o } foreach(int i in array) { // do something with i }  Collection objects have a GetEnumerator() method which returns an Enumerator object.  An Enumerator object has a MoveNext method and a Current property.
  • 8. IEnumerable Collections in .NET use the Iterator Design Pattern, hence they do not implement IEnumerator. Instead they implement IEnumerable. Creates a new instance of an IEnumerator and returns it. public interface IEnumerable { IEnumerator GetEnumerator(); }
  • 9. Enumerable Collections What collections are enumerable? That is, support the IEnumerable or IEnumerable<T> interfaces? System.Array – all arrays support IEnumerable<T> All .NET collections except dictionaries. System.String or string. Any user-defined class supporting the interface.
  • 10.
  • 11. Collection-Drawbacks No type checking enforcement at compile time Doesn’t prevent adding unwanted types Can lead to difficult to troubleshoot issues Runtime errors! All items are stored as objects Must be cast going in and coming out Performance overhead of boxing and unboxing specific types