Delegates and Events

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/55

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:19 PM on 9/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

56 Terms

1
New cards

Delegate

A class in .NET that encapsulates a method.

2
New cards

Delegate

A reference type data type that holds a reference to a method.

3
New cards

Delegate

A class that can call any method as long as its signature matches.

4
New cards

delegate keyword

The keyword used in declaring a delegate on a class.

5
New cards

Signature

Must match between a delegate and the method it references.

6
New cards

Access modifier

The first item to identify when declaring a delegate.

7
New cards

Return type

The type specified when declaring a delegate, such as void, int, or string.

8
New cards

Delegate name

The desired name specified when declaring a delegate.

9
New cards

Parameters

The parameters specified inside the open and close parentheses of a delegate declaration.

10
New cards
delegate ()

Delegate declaration syntax

11
New cards

Delegate instantiation

The process of creating a delegate instance that refers to a method.

12
New cards

new keyword

The keyword used to instantiate a delegate in the example.

13
New cards

Delegate invocation

The process of invoking a referenced method through a delegate.

14
New cards

Referenced method

The method that a delegate references.

15
New cards

Parameters of a delegate

The parameters that should have the same count as the referenced method when referencing it.

16
New cards

Generic delegates

Delegates that are not bound to any specific type.

17
New cards

Generic delegate

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

18
New cards

Type parameter

The type represented by X in the generic delegate example.

19
New cards

Delegates and interfaces

Both include the declaration, but they have differences.

20
New cards

Delegates

They have no implementation; they are just safe callbacks and only have a declaration.

21
New cards

Interfaces

A class that implements this can implement all the methods associated with it.

22
New cards

Delegates

They can reference any method of a class that provides arguments and return types.

23
New cards

Interfaces

This allows extending some of the objects’ functionality.

24
New cards

Delegates

They are used if a class needs more than one implementation of the method.

25
New cards

Interfaces

They can implement a method only once.

26
New cards

Delegates

They are faster to execute but slower to get.

27
New cards

Interfaces

They are slower in executing but faster to get.

28
New cards

Event handling

In C#.NET, events are usually task initiators.

29
New cards

Event

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

30
New cards

Event

This occurs when a specific action takes place.

31
New cards

Event handler

The method that is created and registered to an event and is automatically invoked when the event occurs.

32
New cards

Event handler

The methods that are invoked when an event occurs.

33
New cards

Method registration

This is done through delegates that specify the signature of a method registered for it.

34
New cards

Event declaration

Before declaring an event, a delegate to which the event is supposed to be associated should be declared first.

35
New cards

Event-associated delegate

The delegate to which an event is supposed to be associated.

36
New cards

Delegate in the event declaration

The delegate that contains two parameters and can reference methods that have the same count of parameters.

37
New cards

Parameter count

It can reference a method with the same count of parameters.

38
New cards

Event declaration

What is the next step after declaring the delegate?

39
New cards

public event delegate_name event_name

Event declaration syntax.

40
New cards

event keyword

The keyword used when declaring an event.

41
New cards

Event name

The preferred name given to an event when declaring it.

42
New cards

Delegate name

This is used in the event declaration.

43
New cards

Adding a delegate to an event

The process of registering a delegate with an event using the += operator.

44
New cards

+= operator

The operator used to add a delegate to an event.

45
New cards

Event subscription

The registration of a new subscription to an event.

46
New cards

event_name += delegate_instance

Event subscription syntax.

47
New cards

Event accessors

The two methods automatically generated by the compiler when the += operator is used with an event.

48
New cards

add accessor An event accessor used to register a new subscription to an event.

49
New cards

remove accessor An event accessor used to unregister the subscription to an event.

50
New cards

Property accessors The get and set accessors used with properties.

51
New cards

Event accessors

The add and remove accessors that are similar to the get and set accessors used with properties.

52
New cards

Unregistering a subscription

The process performed by using the remove accessor.

53
New cards

Registering a subscription

The process performed by using the add accessor.

54
New cards

add and remove

The two event accessors generated by the compiler.

55
New cards

Event accessor code

The code that can be used in add and remove to check some conditions before registering or unregistering the subscriber.

56
New cards

Subscriber

The method or delegate registered or unregistered through an event's add or remove accessor.