Event-Driven

0.0(0)
studied byStudied by 8 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/52

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

53 Terms

1
New cards

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.

2
New cards

<access modifier> delegate <return type> <delegate-name> (<parameters>)

declaring a delegate

3
New cards

Generic delegates

  • are not bound to any specific type.

  • can reference a method that returns and takes parameters of different types.

4
New cards

events

are usually task initiators

5
New cards

event

is a member of a class that is fired whenever a specific action takes place.

6
New cards

event handlers.

The methods that are invoked when an event occurs are known as __________

7
New cards

public event delegate_name event_name;

declaration of event

8
New cards

event_name += delegate_instance;

adding an event

9
New cards

+=

oprerator used to add an event to the class

10
New cards

add

to register a new subscription to an event, use the _______ accessor

11
New cards

remove

to unregister a new subscription to an event, use the _______ accessor

12
New cards

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

13
New cards

Standard collections

These are found in the System.Collections namespace

14
New cards

Generic collections

These are found in the System.Collections.Generic namespace

15
New cards

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

16
New cards

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

17
New cards

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.

18
New cards

Capacity

gets or sets the capacity

19
New cards

Count

gets the count of the number of elements i

20
New cards

Item

gets and sets the value associated with a specific key

21
New cards

Keys

carry the key

22
New cards

Values

carry the values

23
New cards

void Add(object key, object value)

adds an item with the specified key and value

24
New cards

void Clear()

used to remove all the items

25
New cards

bool ContainsKey(object key)

If it contains the specified key, then it will return the Boolean value true.

26
New cards

bool ContainsValue(object value)

If it contains the specified value, then it will return the Boolean value true.

27
New cards

object GetByIndex(int index)

returns the value of the specified index

28
New cards

object GetKey(int index)

returns the key of the specified index

29
New cards

void Remove(object key)

a key that is specified will remove its element.

30
New cards

void RemoveAt(int index)

It is an index that is specified will remove its element

31
New cards

Stack

  • represents a Last In, First Out (LIFO) collection of objects.

  • When inserting and removing objects from the _____, it uses push and pop operations

32
New cards

Queue

  • represents a First In, First Out (FIFO) collection of objects.

  • Adding and removing objects from the _____ class uses an enqueue and dequeue operations.

33
New cards

IEnumerable

an interface that allows you to loop through elements in a collection.

34
New cards

ICollection

interface that allows you to determine the number of elements in a collections and copy them in a simple array type.

35
New cards

IDictionary

interface that provides a list of elements that are accessible via a key or value rather than an index.

36
New cards

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.

37
New cards

System.Collections.Generic

namespace contains several generic collection classes

38
New cards

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.

39
New cards

List <T>variableName = new List <T>();

format for creating a List <T> collection.

40
New cards

Add()

  • used to add items and is placed to the end of a list.

  • The elements can be accessed by calling its index value.

41
New cards

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.

42
New cards

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.

43
New cards

Sort()

used to sort the element in the list object.

44
New cards

Queue<T>

a generic collection that represents a First In, First Out (FIFO) collection of objects

45
New cards

Queue <int> ageQueue = new Queue<int>();

format defines a generic queue

46
New cards

Enqueue()

adds an element to the end of queue.

47
New cards

Peek()

l return the element at the beginning of the queue/stack without removing it

48
New cards

Dequeue()

removes and returns the value at the beginning of the queue.

49
New cards

Stack<T>

represents the Last In, First Out (LIFO) collection of instances.

50
New cards

Stack<int> ageStack = new Stack<int>(20);

format defines a generic stack

51
New cards

Push()

adds an element at the top in the stack.

52
New cards

Pop()

removes and returns the value at the top of the stack

53
New cards

public delegate X DelegateName <X> (X arg);

declaring a generic delegate