1/52
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Delegate
is a class in .NET that encapsulates a method.
reference type data type that holds a reference method.
can call any method as long as its signature matches.
<access modifier> delegate <return type> <delegate-name> (<parameters>)
declaring a delegate
Generic delegates
are not bound to any specific type.
can reference a method that returns and takes parameters of different types.
events
are usually task initiators
event
is a member of a class that is fired whenever a specific action takes place.
event handlers.
The methods that are invoked when an event occurs are known as __________
public event delegate_name event_name;
declaration of event
event_name += delegate_instance;
adding an event
+=
oprerator used to add an event to the class
add
to register a new subscription to an event, use the _______ accessor
remove
to unregister a new subscription to an event, use the _______ accessor
collections
group of objects that provides a standard set of types for storing and managing collections of objects
contains lists, linked lists, dictionaries, and arrays to manage collections of objects
Standard collections
These are found in the System.Collections namespace
Generic collections
These are found in the System.Collections.Generic namespace
ArrayList
a collections class that is known for an ordered collection of objects
is not the same as an array that is static in size
dynamic since items can be added and removed from the specified index location
Hashtable
stores key or value pairs where the key represents the value in the collection
When accessing the values in _______, the key must be specified
SortedList
a combination of ArrayList and Hashtable.
stores key or value pairs where the key values sort values.
To access the values in ________,the key or index value must be specified.
Capacity
gets or sets the capacity
Count
gets the count of the number of elements i
Item
gets and sets the value associated with a specific key
Keys
carry the key
Values
carry the values
void Add(object key, object value)
adds an item with the specified key and value
void Clear()
used to remove all the items
bool ContainsKey(object key)
If it contains the specified key, then it will return the Boolean value true.
bool ContainsValue(object value)
If it contains the specified value, then it will return the Boolean value true.
object GetByIndex(int index)
returns the value of the specified index
object GetKey(int index)
returns the key of the specified index
void Remove(object key)
a key that is specified will remove its element.
void RemoveAt(int index)
It is an index that is specified will remove its element
Stack
represents a Last In, First Out (LIFO) collection of objects.
When inserting and removing objects from the _____, it uses push and pop operations
Queue
represents a First In, First Out (FIFO) collection of objects.
Adding and removing objects from the _____ class uses an enqueue and dequeue operations.
IEnumerable
an interface that allows you to loop through elements in a collection.
ICollection
interface that allows you to determine the number of elements in a collections and copy them in a simple array type.
IDictionary
interface that provides a list of elements that are accessible via a key or value rather than an index.
Generics
makes the code reusable across different types by creating a template that contains placeholder types
allows specifying the data types of the programming elements when they are actually used in the program
it allows creating collections like linked lists, hashtables, stacks, and queues that operate on an item of any data type.
System.Collections.Generic
namespace contains several generic collection classes
List<T>
generic collection that provides an efficient and dynamically allocated array, which is commonly used to store a list of duplicate objects.
can grow and shrink with the number of objects.
List <T>variableName = new List <T>();
format for creating a List <T> collection.
Add()
used to add items and is placed to the end of a list.
The elements can be accessed by calling its index value.
Remove()
removes the specified item from the list of object.
if in case the list contains duplicate data, the method removes the first matching instance.
IndexOf()
used to check the specified element in the specified list object. It will return its index value if it is found; if not, it will return the value of -1.
Sort()
used to sort the element in the list object.
Queue<T>
a generic collection that represents a First In, First Out (FIFO) collection of objects
Queue <int> ageQueue = new Queue<int>();
format defines a generic queue
Enqueue()
adds an element to the end of queue.
Peek()
l return the element at the beginning of the queue/stack without removing it
Dequeue()
removes and returns the value at the beginning of the queue.
Stack<T>
represents the Last In, First Out (LIFO) collection of instances.
Stack<int> ageStack = new Stack<int>(20);
format defines a generic stack
Push()
adds an element at the top in the stack.
Pop()
removes and returns the value at the top of the stack
public delegate X DelegateName <X> (X arg);
declaring a generic delegate