1/26
Flashcards containing key terms, methods, classes, syntax rules, and concepts for C# collections, delegates, and events from the lecture transcript.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Queue
A class that represents the 'First In, First Out' collection of objects.
Delegate
A type that safely encapsulates a method and can call any method as long as its signature matches.
delegate (keyword)
The keyword used to declare a delegate in a class.
Delegate Declaration Syntax
public delegate int delegateName();
Delegate Instantiation Syntax
DelegateName dn = new DelegateName(ClassName.MethodName);
SortedList
A type of collection used to arrange key values, considered a combination of ArrayList and Hashtable.
GetByIndex()
A method in a SortedList that returns the value of the specified index.
bool ContainsKey()
A method used to check if the SortedList contains the specified key that returns a boolean value true.
void RemoveAt(int index)
A method used to remove the specified element by calling its index in SortedList.
ArrayList
An ordered collection of objects that is dynamic since items can be added and removed from the specified index location.
Remove()
A method used to delete an item from an ArrayList.
Sort()
A method that can be used to arrange the elements in the list object.
Value
The data that can be accessed in the hashtable when a key is specified.
add-remove
Event accessors that are similar to get and set accessors used with properties.
IDictionary
An interface that provides a list of elements that can be accessed through a key or value.
Event
A feature in C# usually known as a task initiator.
System.Collections.Generic
The namespace that contains several generic collection classes.
-= (operator)
An operator used to remove an event from a class.
Adding Item to SortedList Syntax
srtLst.Add("Coffee", 98);
Generic List Declaration Syntax
List varName = new List();
ArrayList General Syntax
ArrayList names = new ArrayList();
Generic Queue Declaration Syntax
Queue varName = new Queue();
Simple Event Class Declaration Syntax
public static delegateName eventName;
List Object Categorization Syntax
varList.Sort()
Adding Object to ArrayList Syntax
ArrayList varList = new ArrayList(); varList.Add("Cake");
Adding Object to Stack Collection Syntax
Stack objStack = new Stack(); objStack.Push("Ball");
Event Add and Remove Accessors Syntax
public event DelegateName EventName { add { delName += value; } remove { delName -= value; } }