SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
C++.NET
Windows Forms Course
L07 –Collections

Mohammad Shaker
mohammadshakergtr.wordpress.com
C++.NET Windows Forms Course
@ZGTRShaker
Welcome!
Collections?
Collections Generic
generic?
Class
Comparer<T>

Description
Provides a base class for implementations of
the IComparer<T>generic interface.

Dictionary<TKey, TValue>
Dictionary<TKey,
TValue>::KeyCollection
Dictionary<TKey,
TValue>::ValueCollection
EqualityComparer<T>

Represents a collection of keys and values.
Represents the collection of keys in a Dictionary<TKey,
TValue>. This class cannot be inherited.

HashSet<T>
KeyedByTypeCollection<TItem>
KeyNotFoundException

Represents a set of values.
Provides a collection whose items are types that serve as keys.
The exception that is thrown when the key specified for
accessing an element in a collection does not match any key in
the collection.

LinkedList<T>
LinkedListNode<T>

Represents a doubly linked list.
Represents a node in a LinkedList<T>. This class cannot be
inherited.

List<T>

Represents a strongly typed list of objects that can be
accessed by index. Provides methods to search, sort, and
manipulate lists.
Represents a first-in, first-out collection of objects.

Queue<T>

Represents the collection of values in a Dictionary<TKey,
TValue>. This class cannot be inherited.
Provides a base class for implementations of
theIEqualityComparer<T> generic interface.
SortedDictionary<TKey, TValue>

Represents a collection of key/value pairs that are sorted on
the key.

SortedDictionary<TKey,
TValue>::KeyCollection

Represents the collection of keys in a SortedDictionary<TKey,
TValue>. This class cannot be inherited.

SortedDictionary<TKey,
TValue>::ValueCollection

Represents the collection of values in
a SortedDictionary<TKey, TValue>. This class cannot be
inherited

SortedList<TKey, TValue>

Represents a collection of key/value pairs that are sorted by
key based on the associated IComparer<T> implementation.

SortedSet<T>

Represents a collection of objects that is maintained in sorted
order.
Represents a variable size last-in-first-out (LIFO) collection of
instances of the same arbitrary type.

Stack<T>

SynchronizedCollection<T>

Provides a thread-safe collection that contains objects of a
type specified by the generic parameter as elements.

SynchronizedKeyedCollection<K, T>

Provides a thread-safe collection that contains objects of a
type specified by a generic parameter and that are grouped by
keys.

SynchronizedReadOnlyCollection<T>

Provides a thread-safe, read-only collection that contains
objects of a type specified by the generic parameter as
elements.
Peak on Collections
private : System::Collections::Generic::LinkedList <String ^> ^MyStrList ;
private : System::Collections::Generic::List<TextBox ^> ^List ;
private : System::Collections::Generic::Stack <String ^> ^ MyStack;
private : System::Collections::ArrayList ^MyArrayList ;
Peak on Collections
private : System::Collections::Generic::Stack < String ^> ^MyStack;

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
MyStack = gcnew System::Collections::Generic::Stack < String ^>;
}
Peak on Collections
• Let’s have the following!
private : System::Collections::Generic::LinkedList <Button^> ^MyList;

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
MyList = gcnew System::Collections::Generic:: LinkedList <Button ^>;
}
Peak on Collections
private : System::Collections::Generic::LinkedList < String ^> ^MyList;
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^
e)
{
MyList = gcnew System::Collections::Generic::LinkedList < String ^>;
}

private: System::Void button1_Click_1(System::Object^
System::EventArgs^ e)
{
MyList->AddLast(“MeMe");
MyList->AddLast(“MeMa");
}

sender,
Peak on Collections
• What’s wrong?
private : System::Collections::Generic::LinkedList < String ^> ^MyList;
private: System::Void button1_Click_1(System::Object^
System::EventArgs^ e)
{
MyList->AddLast(“MeMe");
MyList->AddLast(“MeMa");
}
Runtime error. the LinkedList is still NULL

sender,
Peak on Collections
• “for each” loop
private: System::Void button1_Click_1(System::Object^ sender,
System::EventArgs^ e)
{
for each (String ^str in MyList)
{
textBox1->Text += str + Environment::NewLine ;
}
}
private : System::Collections::Generic::LinkedList < String ^> ^MyList;
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^
e)
{
MyList = gcnew System::Collections::Generic::LinkedList < String ^>;
}
private: System::Void button1_Click_1(System::Object^
System::EventArgs^ e)
{
MyList->AddLast(textBox1->Text);
}

sender,

private: System::Void button1_Click_2(System::Object^ sender,
System::EventArgs^ e)
{
for each (String ^str in MyList)
{
textBox1->Text += str + Environment::NewLine ;
}
}
private : System::Collections::Generic::LinkedList < Button^> ^MyList;
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^
e)
{
MyList = gcnew System::Collections::Generic::LinkedList < Button ^>;
}
private: System::Void button1_Click_1(System::Object^
System::EventArgs^ e)
{
Button ^B1 = gcnew Button ;
MyList->AddLast(B1);
}

sender,

private: System::Void button1_Click_2(System::Object^ sender,
System::EventArgs^ e)
{
static int Counter = 1 ;
for each (Button ^B in MyList)
{
B->Text = “Button” + Counter.ToString();
B->Height = 30 ; B->Width = 50 ;
Counter++ ;
}
}
Peak on Collections
• Needs to be static?
private: System::Void button1_Click_2(System::Object^ sender,
System::EventArgs^ e)
{
int Counter = 1 ;
for each (Button ^B in MyList)
{
B->Text = “Button” + Counter.ToString();
B->Height = 30 ; B->Width = 50 ;
Counter++ ;
}
}
Peak on Collections - List
private: System::Collections::Generic::List<String^> ^MyList ;

private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyList = gcnew
System::Collections::Generic::List<String^> (4) ;
MyList->Add("Z") ;
MyList->Add("G") ;
MyList->Add("T") ;
MyList->Add("R") ;
}
private: System::Void button1_Click_1(System::Object^
sender, System::EventArgs^ e)
{
for each (String ^str in MyList)
{
textBox1->Text += str + " " ;
}
}
List
List
private: System::Collections::Generic::List<String^> ^MyList ;

private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyList = gcnew System::Collections::Generic::List<String^> (4) ;
MyList->Add("Z") ;
MyList->Add("G") ;
MyList->Add("T") ;
MyList->Add("R") ;
}
private: System::Void button1_Click_1(System::Object^ sender,
System::EventArgs^ e)
{
for(int i=0; i<4 ; i++)
{
textBox1->Text += MyList[i] + " ";
}
}
List
List
private: System::Collections::Generic::List<String^> ^MyList ;

private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyList = gcnew
System::Collections::Generic::List<String^> (4) ;
MyList[0] = “Z” ;
MyList[1] = “G” ;
MyList[2] = “T” ;
MyList[3] = “R” ;
}
private: System::Void button1_Click_1(System::Object^
sender, System::EventArgs^ e)
{
for(int i=0; i<4 ; i++)
{
textBox1->Text += MyList[i] + " ";
}
}
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1 = gcnew Button ;
TextBox ^T1 ;
// Not initialized
String ^S = "ZGTR";
int i ;
// Not initialized
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
}
Everything is good
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1,^B2= gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
MyArrayList[0] = B2 ;
MyArrayList[3] = 6 ;
}

Everything is good
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1,^B2= gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
MyArrayList[0] = B2 ;
MyArrayList[3] = B2 ; // Here!
}

Everything is good
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1,^B2= gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
MyArrayList[0] = 6;
// Here!
MyArrayList[3] = B2 ; // Here!
}

Everything is good
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1,^B2= gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
B1->Height = 50 ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
MyArrayList[0] = B2 ;
MyArrayList[3] = 6 ;
}

Compiler error. No new for Button1
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1,^B2= gcnew Button ;
B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
B1->Height = 50 ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
MyArrayList[0] = B2 ;
MyArrayList[3] = 6 ;
}

Everything is good
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1,^B2= gcnew Button ;
B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
B1->Height = 50 ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
MyArrayList[0] = B2 ;
MyArrayList[4] = 6 ;
}

Compiler error. index = 4! Wrong!
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1,^B2= gcnew Button ;
B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
B1->Height = 50 ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
B2 = MyArrayList[0] ; // 1
MyArrayList[3] = 6 ;
}

Compiler error. object^ and Button^ in 1
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
}
Everything is good
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;

private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
}
private: System::Void button1_Click_1(System::Object^
System::EventArgs^ e)
{
textBox1->Text =MyArrayList[0] ->Height ;
}

Compile error

sender,
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;

private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
}
private: System::Void button1_Click_1(System::Object^ sender,
System::EventArgs^ e)
{
textBox1->Text =(MyArrayList[0]->Height)->ToString() ;
}

Compile error
Peak on Collections – ArrayList
private: System::Collections::ArrayList ^MyArrayList ;

private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
}
private: System::Void button1_Click_1(System::Object^ sender,
System::EventArgs^ e)
{
textBox1->Text =(MyArrayList[0]->Height).ToString() ;
}

Compile error
ArrayList - dynamic_cast
private: System::Collections::ArrayList ^MyArrayList ;

private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
}
private: System::Void button1_Click_1(System::Object^ sender,
System::EventArgs^ e)
{
textBox1->Text =((dynamic_cast <Button^>(MyArrayList[0]))->Height).ToString();
}

Everything is good. And will print 23. but why?
ArrayList - dynamic_cast
private: System::Collections::ArrayList ^MyArrayList ;
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
MyArrayList = gcnew System::Collections::ArrayList (4) ;
static int Counter = 0 ;
Button ^B1 = gcnew Button ;
TextBox ^T1 ;
String ^S = "ZGTR";
int i ;
B1->Height = 30 ;
MyArrayList->Add(B1) ;
MyArrayList->Add(T1) ;
MyArrayList->Add(S) ;
MyArrayList->Add(i) ;
}

private: System::Void button1_Click_1(System::Object^ sender,
System::EventArgs^ e)
{
textBox1->Text =((dynamic_cast <Button^>(MyArrayList[0]))->Height).ToString();
}

Everything is good. And will print 30.
ArrayList
• It’s not a Generic*
– private: System::Collections::ArrayList ^MyArrayList ;

• Drop in performance!

_____________________________________________________
*Generic : class Typed
Enough said,
let’s dig deep live
That’s it for today!

Contenu connexe

Tendances

The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181Mahmoud Samir Fayed
 
Poor Man's Functional Programming
Poor Man's Functional ProgrammingPoor Man's Functional Programming
Poor Man's Functional ProgrammingDmitry Buzdin
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
The Ring programming language version 1.5.3 book - Part 7 of 184
The Ring programming language version 1.5.3 book - Part 7 of 184The Ring programming language version 1.5.3 book - Part 7 of 184
The Ring programming language version 1.5.3 book - Part 7 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 5 of 88
The Ring programming language version 1.3 book - Part 5 of 88The Ring programming language version 1.3 book - Part 5 of 88
The Ring programming language version 1.3 book - Part 5 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 6 of 180
The Ring programming language version 1.5.1 book - Part 6 of 180The Ring programming language version 1.5.1 book - Part 6 of 180
The Ring programming language version 1.5.1 book - Part 6 of 180Mahmoud Samir Fayed
 
C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-CollectionsMohammad Shaker
 
C# Starter L02-Classes and Objects
C# Starter L02-Classes and ObjectsC# Starter L02-Classes and Objects
C# Starter L02-Classes and ObjectsMohammad Shaker
 
(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manualChandrapriya Jayabal
 
The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180Mahmoud Samir Fayed
 
Introduction to Python programming
Introduction to Python programmingIntroduction to Python programming
Introduction to Python programmingDamian T. Gordon
 
Collectors in the Wild
Collectors in the WildCollectors in the Wild
Collectors in the WildJosé Paumard
 

Tendances (20)

The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181The Ring programming language version 1.5.2 book - Part 7 of 181
The Ring programming language version 1.5.2 book - Part 7 of 181
 
Poor Man's Functional Programming
Poor Man's Functional ProgrammingPoor Man's Functional Programming
Poor Man's Functional Programming
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
The Ring programming language version 1.5.3 book - Part 7 of 184
The Ring programming language version 1.5.3 book - Part 7 of 184The Ring programming language version 1.5.3 book - Part 7 of 184
The Ring programming language version 1.5.3 book - Part 7 of 184
 
The Ring programming language version 1.3 book - Part 5 of 88
The Ring programming language version 1.3 book - Part 5 of 88The Ring programming language version 1.3 book - Part 5 of 88
The Ring programming language version 1.3 book - Part 5 of 88
 
Colegio municipal
Colegio municipalColegio municipal
Colegio municipal
 
Dill
DillDill
Dill
 
The Ring programming language version 1.5.1 book - Part 6 of 180
The Ring programming language version 1.5.1 book - Part 6 of 180The Ring programming language version 1.5.1 book - Part 6 of 180
The Ring programming language version 1.5.1 book - Part 6 of 180
 
Presentation new
Presentation newPresentation new
Presentation new
 
C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-Collections
 
C# Starter L02-Classes and Objects
C# Starter L02-Classes and ObjectsC# Starter L02-Classes and Objects
C# Starter L02-Classes and Objects
 
(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual
 
Lesson11
Lesson11Lesson11
Lesson11
 
VB Dot net
VB Dot net VB Dot net
VB Dot net
 
Collection
CollectionCollection
Collection
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
 
The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180The Ring programming language version 1.5.1 book - Part 13 of 180
The Ring programming language version 1.5.1 book - Part 13 of 180
 
Introduction to Python programming
Introduction to Python programmingIntroduction to Python programming
Introduction to Python programming
 
Collectors in the Wild
Collectors in the WildCollectors in the Wild
Collectors in the Wild
 

Similaire à C++ Windows Forms L07 - Collections

COLLECTIONS.pptx
COLLECTIONS.pptxCOLLECTIONS.pptx
COLLECTIONS.pptxSruthyPJ
 
Collections generic
Collections genericCollections generic
Collections genericsandhish
 
collectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxcollectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxhemanth248901
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212Mahmoud Samir Fayed
 
Java 8, lambdas, generics: How to survive? - NYC Java Meetup Group
Java 8, lambdas, generics: How to survive? - NYC Java Meetup GroupJava 8, lambdas, generics: How to survive? - NYC Java Meetup Group
Java 8, lambdas, generics: How to survive? - NYC Java Meetup GroupHenri Tremblay
 
Generic Programming &amp; Collection
Generic Programming &amp; CollectionGeneric Programming &amp; Collection
Generic Programming &amp; CollectionArya
 
Generic Programming &amp; Collection
Generic Programming &amp; CollectionGeneric Programming &amp; Collection
Generic Programming &amp; CollectionArya
 
Lambdas and Generics (long version) - Bordeaux/Toulouse JUG
Lambdas and Generics (long version) - Bordeaux/Toulouse JUGLambdas and Generics (long version) - Bordeaux/Toulouse JUG
Lambdas and Generics (long version) - Bordeaux/Toulouse JUGHenri Tremblay
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfmayorothenguyenhob69
 
The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184Mahmoud Samir Fayed
 

Similaire à C++ Windows Forms L07 - Collections (20)

F sharp lists & dictionary
F sharp   lists &  dictionaryF sharp   lists &  dictionary
F sharp lists & dictionary
 
COLLECTIONS.pptx
COLLECTIONS.pptxCOLLECTIONS.pptx
COLLECTIONS.pptx
 
JAVA PROGRAMMING - The Collections Framework
JAVA PROGRAMMING - The Collections Framework JAVA PROGRAMMING - The Collections Framework
JAVA PROGRAMMING - The Collections Framework
 
07 java collection
07 java collection07 java collection
07 java collection
 
Collections generic
Collections genericCollections generic
Collections generic
 
collections
collectionscollections
collections
 
collectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxcollectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptx
 
javacollections.pdf
javacollections.pdfjavacollections.pdf
javacollections.pdf
 
The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88The Ring programming language version 1.3 book - Part 13 of 88
The Ring programming language version 1.3 book - Part 13 of 88
 
The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212
 
Java 8, lambdas, generics: How to survive? - NYC Java Meetup Group
Java 8, lambdas, generics: How to survive? - NYC Java Meetup GroupJava 8, lambdas, generics: How to survive? - NYC Java Meetup Group
Java 8, lambdas, generics: How to survive? - NYC Java Meetup Group
 
collections
 collections collections
collections
 
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
 
List in java
List in javaList in java
List in java
 
Lambdas and Generics (long version) - Bordeaux/Toulouse JUG
Lambdas and Generics (long version) - Bordeaux/Toulouse JUGLambdas and Generics (long version) - Bordeaux/Toulouse JUG
Lambdas and Generics (long version) - Bordeaux/Toulouse JUG
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdf
 
Presentation1
Presentation1Presentation1
Presentation1
 
Collections
CollectionsCollections
Collections
 
The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184
 

Plus de Mohammad Shaker

12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian GraduateMohammad Shaker
 
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Mohammad Shaker
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyMohammad Shaker
 
Short, Matters, Love - Passioneers Event 2015
Short, Matters, Love -  Passioneers Event 2015Short, Matters, Love -  Passioneers Event 2015
Short, Matters, Love - Passioneers Event 2015Mohammad Shaker
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game DevelopmentMohammad Shaker
 
Android L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesAndroid L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesMohammad Shaker
 
Interaction Design L03 - Color
Interaction Design L03 - ColorInteraction Design L03 - Color
Interaction Design L03 - ColorMohammad Shaker
 
Interaction Design L05 - Typography
Interaction Design L05 - TypographyInteraction Design L05 - Typography
Interaction Design L05 - TypographyMohammad Shaker
 
Interaction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingInteraction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingMohammad Shaker
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and ThreadingMohammad Shaker
 
Android L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSAndroid L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSMohammad Shaker
 
Interaction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsInteraction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsMohammad Shaker
 
Interaction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsInteraction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsMohammad Shaker
 
Android L10 - Stores and Gaming
Android L10 - Stores and GamingAndroid L10 - Stores and Gaming
Android L10 - Stores and GamingMohammad Shaker
 
Android L06 - Cloud / Parse
Android L06 - Cloud / ParseAndroid L06 - Cloud / Parse
Android L06 - Cloud / ParseMohammad Shaker
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesMohammad Shaker
 
Android L03 - Styles and Themes
Android L03 - Styles and Themes Android L03 - Styles and Themes
Android L03 - Styles and Themes Mohammad Shaker
 
Android L02 - Activities and Adapters
Android L02 - Activities and AdaptersAndroid L02 - Activities and Adapters
Android L02 - Activities and AdaptersMohammad Shaker
 

Plus de Mohammad Shaker (20)

12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate12 Rules You Should to Know as a Syrian Graduate
12 Rules You Should to Know as a Syrian Graduate
 
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with Psychology
 
Short, Matters, Love - Passioneers Event 2015
Short, Matters, Love -  Passioneers Event 2015Short, Matters, Love -  Passioneers Event 2015
Short, Matters, Love - Passioneers Event 2015
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game Development
 
Android L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and WearablesAndroid L07 - Touch, Screen and Wearables
Android L07 - Touch, Screen and Wearables
 
Interaction Design L03 - Color
Interaction Design L03 - ColorInteraction Design L03 - Color
Interaction Design L03 - Color
 
Interaction Design L05 - Typography
Interaction Design L05 - TypographyInteraction Design L05 - Typography
Interaction Design L05 - Typography
 
Interaction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and CouplingInteraction Design L04 - Materialise and Coupling
Interaction Design L04 - Materialise and Coupling
 
Android L05 - Storage
Android L05 - StorageAndroid L05 - Storage
Android L05 - Storage
 
Android L04 - Notifications and Threading
Android L04 - Notifications and ThreadingAndroid L04 - Notifications and Threading
Android L04 - Notifications and Threading
 
Android L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOSAndroid L09 - Windows Phone and iOS
Android L09 - Windows Phone and iOS
 
Interaction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile ConstraintsInteraction Design L01 - Mobile Constraints
Interaction Design L01 - Mobile Constraints
 
Interaction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and GridsInteraction Design L02 - Pragnanz and Grids
Interaction Design L02 - Pragnanz and Grids
 
Android L10 - Stores and Gaming
Android L10 - Stores and GamingAndroid L10 - Stores and Gaming
Android L10 - Stores and Gaming
 
Android L06 - Cloud / Parse
Android L06 - Cloud / ParseAndroid L06 - Cloud / Parse
Android L06 - Cloud / Parse
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and Utilities
 
Android L03 - Styles and Themes
Android L03 - Styles and Themes Android L03 - Styles and Themes
Android L03 - Styles and Themes
 
Android L02 - Activities and Adapters
Android L02 - Activities and AdaptersAndroid L02 - Activities and Adapters
Android L02 - Activities and Adapters
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 

Dernier

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Dernier (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

C++ Windows Forms L07 - Collections

  • 1. C++.NET Windows Forms Course L07 –Collections Mohammad Shaker mohammadshakergtr.wordpress.com C++.NET Windows Forms Course @ZGTRShaker
  • 5. Class Comparer<T> Description Provides a base class for implementations of the IComparer<T>generic interface. Dictionary<TKey, TValue> Dictionary<TKey, TValue>::KeyCollection Dictionary<TKey, TValue>::ValueCollection EqualityComparer<T> Represents a collection of keys and values. Represents the collection of keys in a Dictionary<TKey, TValue>. This class cannot be inherited. HashSet<T> KeyedByTypeCollection<TItem> KeyNotFoundException Represents a set of values. Provides a collection whose items are types that serve as keys. The exception that is thrown when the key specified for accessing an element in a collection does not match any key in the collection. LinkedList<T> LinkedListNode<T> Represents a doubly linked list. Represents a node in a LinkedList<T>. This class cannot be inherited. List<T> Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists. Represents a first-in, first-out collection of objects. Queue<T> Represents the collection of values in a Dictionary<TKey, TValue>. This class cannot be inherited. Provides a base class for implementations of theIEqualityComparer<T> generic interface.
  • 6. SortedDictionary<TKey, TValue> Represents a collection of key/value pairs that are sorted on the key. SortedDictionary<TKey, TValue>::KeyCollection Represents the collection of keys in a SortedDictionary<TKey, TValue>. This class cannot be inherited. SortedDictionary<TKey, TValue>::ValueCollection Represents the collection of values in a SortedDictionary<TKey, TValue>. This class cannot be inherited SortedList<TKey, TValue> Represents a collection of key/value pairs that are sorted by key based on the associated IComparer<T> implementation. SortedSet<T> Represents a collection of objects that is maintained in sorted order. Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type. Stack<T> SynchronizedCollection<T> Provides a thread-safe collection that contains objects of a type specified by the generic parameter as elements. SynchronizedKeyedCollection<K, T> Provides a thread-safe collection that contains objects of a type specified by a generic parameter and that are grouped by keys. SynchronizedReadOnlyCollection<T> Provides a thread-safe, read-only collection that contains objects of a type specified by the generic parameter as elements.
  • 7. Peak on Collections private : System::Collections::Generic::LinkedList <String ^> ^MyStrList ; private : System::Collections::Generic::List<TextBox ^> ^List ; private : System::Collections::Generic::Stack <String ^> ^ MyStack; private : System::Collections::ArrayList ^MyArrayList ;
  • 8. Peak on Collections private : System::Collections::Generic::Stack < String ^> ^MyStack; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyStack = gcnew System::Collections::Generic::Stack < String ^>; }
  • 9. Peak on Collections • Let’s have the following! private : System::Collections::Generic::LinkedList <Button^> ^MyList; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyList = gcnew System::Collections::Generic:: LinkedList <Button ^>; }
  • 10.
  • 11. Peak on Collections private : System::Collections::Generic::LinkedList < String ^> ^MyList; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyList = gcnew System::Collections::Generic::LinkedList < String ^>; } private: System::Void button1_Click_1(System::Object^ System::EventArgs^ e) { MyList->AddLast(“MeMe"); MyList->AddLast(“MeMa"); } sender,
  • 12. Peak on Collections • What’s wrong? private : System::Collections::Generic::LinkedList < String ^> ^MyList; private: System::Void button1_Click_1(System::Object^ System::EventArgs^ e) { MyList->AddLast(“MeMe"); MyList->AddLast(“MeMa"); } Runtime error. the LinkedList is still NULL sender,
  • 13. Peak on Collections • “for each” loop private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { for each (String ^str in MyList) { textBox1->Text += str + Environment::NewLine ; } }
  • 14. private : System::Collections::Generic::LinkedList < String ^> ^MyList; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyList = gcnew System::Collections::Generic::LinkedList < String ^>; } private: System::Void button1_Click_1(System::Object^ System::EventArgs^ e) { MyList->AddLast(textBox1->Text); } sender, private: System::Void button1_Click_2(System::Object^ sender, System::EventArgs^ e) { for each (String ^str in MyList) { textBox1->Text += str + Environment::NewLine ; } }
  • 15. private : System::Collections::Generic::LinkedList < Button^> ^MyList; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyList = gcnew System::Collections::Generic::LinkedList < Button ^>; } private: System::Void button1_Click_1(System::Object^ System::EventArgs^ e) { Button ^B1 = gcnew Button ; MyList->AddLast(B1); } sender, private: System::Void button1_Click_2(System::Object^ sender, System::EventArgs^ e) { static int Counter = 1 ; for each (Button ^B in MyList) { B->Text = “Button” + Counter.ToString(); B->Height = 30 ; B->Width = 50 ; Counter++ ; } }
  • 16. Peak on Collections • Needs to be static? private: System::Void button1_Click_2(System::Object^ sender, System::EventArgs^ e) { int Counter = 1 ; for each (Button ^B in MyList) { B->Text = “Button” + Counter.ToString(); B->Height = 30 ; B->Width = 50 ; Counter++ ; } }
  • 17. Peak on Collections - List private: System::Collections::Generic::List<String^> ^MyList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyList = gcnew System::Collections::Generic::List<String^> (4) ; MyList->Add("Z") ; MyList->Add("G") ; MyList->Add("T") ; MyList->Add("R") ; } private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { for each (String ^str in MyList) { textBox1->Text += str + " " ; } }
  • 18. List
  • 19. List private: System::Collections::Generic::List<String^> ^MyList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyList = gcnew System::Collections::Generic::List<String^> (4) ; MyList->Add("Z") ; MyList->Add("G") ; MyList->Add("T") ; MyList->Add("R") ; } private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { for(int i=0; i<4 ; i++) { textBox1->Text += MyList[i] + " "; } }
  • 20. List
  • 21. List private: System::Collections::Generic::List<String^> ^MyList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyList = gcnew System::Collections::Generic::List<String^> (4) ; MyList[0] = “Z” ; MyList[1] = “G” ; MyList[2] = “T” ; MyList[3] = “R” ; } private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { for(int i=0; i<4 ; i++) { textBox1->Text += MyList[i] + " "; } }
  • 22. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1 = gcnew Button ; TextBox ^T1 ; // Not initialized String ^S = "ZGTR"; int i ; // Not initialized MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; } Everything is good
  • 23. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1,^B2= gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; MyArrayList[0] = B2 ; MyArrayList[3] = 6 ; } Everything is good
  • 24. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1,^B2= gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; MyArrayList[0] = B2 ; MyArrayList[3] = B2 ; // Here! } Everything is good
  • 25. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1,^B2= gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; MyArrayList[0] = 6; // Here! MyArrayList[3] = B2 ; // Here! } Everything is good
  • 26. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1,^B2= gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; B1->Height = 50 ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; MyArrayList[0] = B2 ; MyArrayList[3] = 6 ; } Compiler error. No new for Button1
  • 27. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1,^B2= gcnew Button ; B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; B1->Height = 50 ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; MyArrayList[0] = B2 ; MyArrayList[3] = 6 ; } Everything is good
  • 28. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1,^B2= gcnew Button ; B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; B1->Height = 50 ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; MyArrayList[0] = B2 ; MyArrayList[4] = 6 ; } Compiler error. index = 4! Wrong!
  • 29. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1,^B2= gcnew Button ; B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; B1->Height = 50 ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; B2 = MyArrayList[0] ; // 1 MyArrayList[3] = 6 ; } Compiler error. object^ and Button^ in 1
  • 30. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; } Everything is good
  • 31. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; } private: System::Void button1_Click_1(System::Object^ System::EventArgs^ e) { textBox1->Text =MyArrayList[0] ->Height ; } Compile error sender,
  • 32. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; } private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { textBox1->Text =(MyArrayList[0]->Height)->ToString() ; } Compile error
  • 33. Peak on Collections – ArrayList private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; } private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { textBox1->Text =(MyArrayList[0]->Height).ToString() ; } Compile error
  • 34. ArrayList - dynamic_cast private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; } private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { textBox1->Text =((dynamic_cast <Button^>(MyArrayList[0]))->Height).ToString(); } Everything is good. And will print 23. but why?
  • 35. ArrayList - dynamic_cast private: System::Collections::ArrayList ^MyArrayList ; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyArrayList = gcnew System::Collections::ArrayList (4) ; static int Counter = 0 ; Button ^B1 = gcnew Button ; TextBox ^T1 ; String ^S = "ZGTR"; int i ; B1->Height = 30 ; MyArrayList->Add(B1) ; MyArrayList->Add(T1) ; MyArrayList->Add(S) ; MyArrayList->Add(i) ; } private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) { textBox1->Text =((dynamic_cast <Button^>(MyArrayList[0]))->Height).ToString(); } Everything is good. And will print 30.
  • 36. ArrayList • It’s not a Generic* – private: System::Collections::ArrayList ^MyArrayList ; • Drop in performance! _____________________________________________________ *Generic : class Typed
  • 38. That’s it for today!