SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Downloaden Sie, um offline zu lesen
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!

Weitere ähnliche Inhalte

Was ist angesagt?

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
 
Presentation new
Presentation newPresentation new
Presentation newDiwakar raja
 
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
 

Was ist angesagt? (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
 

Ă„hnlich wie C++ Windows Forms L07 - Collections

F sharp lists & dictionary
F sharp   lists &  dictionaryF sharp   lists &  dictionary
F sharp lists & dictionaryDrRajeshreeKhande
 
COLLECTIONS.pptx
COLLECTIONS.pptxCOLLECTIONS.pptx
COLLECTIONS.pptxSruthyPJ
 
07 java collection
07 java collection07 java collection
07 java collectionAbhishek Khune
 
Collections generic
Collections genericCollections generic
Collections genericsandhish
 
collections
collectionscollections
collectionsjaveed_mhd
 
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
 
List in java
List in javaList in java
List in javanitin kumar
 
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
 
Presentation1
Presentation1Presentation1
Presentation1Anand Grewal
 
Collections
CollectionsCollections
Collectionssagsharma
 
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
 

Ă„hnlich wie 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
 

Mehr von 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 L05 - Storage
Android L05 - StorageAndroid L05 - Storage
Android L05 - StorageMohammad 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
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm UpMohammad Shaker
 

Mehr von 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
 

KĂĽrzlich hochgeladen

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

KĂĽrzlich hochgeladen (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

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