EVENT DRIVEN REVIEWER
Delegate
Definition: is a class in NET that encapsulates a method.
Declaring and instantiating a delegate
Definition: The delegate keyword is used in declaring a delegate on a class.
new
Definition: To instantiate the delegate, use the ___ keyword that is associated with the method and supposed to refer on the object.
Invoking Delegates
Definition: Invoking on referenced methods can also be done in delegates.
C#.NET
Definition: events are usually task initiators. Clicking a mouse or pressing the Enter key are the common events that one can create while working with any program.
event
Definition: is a member of a class that is fired whenever a specific action takes place.
event handlers
Definition: Registration of methods is done through delegates that specify the signature of a method registered for it. The methods that are invoked when an event occurs are known as what?
Event Declaration
Definition: Before declaring an event, a delegate to which the event is supposed to be associated should be declared first.
Event Accessors
Definition: Using the += operator allows adding an event to the class.
Event Accessors
Definition: Using the += operator allows adding an event to the class. When this happens, compiler automatically generates 2 event accessors. (add, remove -similar to get, set)
add accessor
Definition: To register a new subscription to an event
remove accessor
Definition: To unregister the subscription
collections
Definition: a group of objects which contains lists, linked lists, dictionaries, and arrays to manage collections of objects.
2 types of collections
Definition: Standard collections and Generic collections
Standard collections
Definition: These are found in the System.Collections namespace.
Generic collections
Definition: These are found in the System.Collections.Generic namespace.
ArrayList
Definition: This is a collections class that is known for an ordered collection of objects.
Hashtable
Definition: This class stores key or value pairs where the key represents the value in the collection.
SortedList
Definition: This class is a combination of ArrayList and Hashtable. It stores key or value pairs where the key values sort values.
Item
Definition: It gets and sets the value associated with a specific key in the SortedList.
void Add(object key, object value)
Definition: It adds an item with the specified key and the value into the SortedList.
void Clear()
Definition: It is used to remove all the items in the SortedList.
bool ContainsValue(object value)
Definition: If the SortedList contains the specified value, then it will return the Boolean value true.
object GetByIndex(int index)
Definition: This method returns the value of the specified index.
object GetKey(int index)
Definition: This method returns the key of the specified index.
void Remove(object key)
Definition: In the SortedList, a key that is specified will remove its element.
void RemoveAt(int index)
Definition: It is an index that is specified will remove its element in the SortedList.
Stack
Definition: This represents (LIFO) collection of objects. uses push and pop operations.
Queue
Definition: This class represents (FIFO) collection of objects. uses an enqueue and dequeue operations.
IEnumerable
Definition: It is an interface that allows you to loop through elements in a collection.
ICollection
Definition: It is an interface that allows you to determine the number of elements in a collections and copy them in a simple array type.
IDictionary
Definition: It is an interface that provides a list of elements that are accessible via a key or value rather than an index.
Generics
Definition: This makes the code reusable across different types by creating a template that contains placeholder types.
Generic Collections
Definition: It avoids creation of custom collections for each type in the application.
List<T>
Definition: It is a generic collection that provides an efficient and dynamically allocated array, which is commonly used to store a list of duplicate objects.
List<T> variableName = new List<T>();
Definition: format for creating a List<T› collection.
Indexof()
Definition: This method is used to check the specified element in the specified list object.
Queue<T>
Definition: It is a generic collection that represents a (FIFO) collection of objects.
Queue<int> ageQueue = new Queue<int>();
Definition: what is the syntax of the generic queue?
Enqueue()
Definition: This method adds an element to the end of queue.
Peek()
Definition: This will return the element at the beginning of the queue without removing it.
Dequeue()
Definition: This method removes and returns the value at the beginning of the queue.
Stack<T>
Definition: This generic collection represents the (LIFO) collection of instances.
Stack<int> ageStack = new Stack<int>(20);
Definition: what is the syntax of the generic stack?
Push()
Definition: This method adds an element at the top in the stack.
Peek()
Definition: This will return the element at the top of the stack without removing it.
Pop()
Definition: This method removes and returns the value at the top of the stack.