C# Event Arguments

C# Code Snippets Event Arguments
Share:

About

In this code snippet, we will take a look at event arguments in C#.

Event arguments allow you to pass data(from publisher to subscriber) with the event when it is triggered. To return data with an event you must make a class that inherits from the EventArgs class. In this new derived class you can add the properties you want to send. Then you return this EventArgs child class with the event.

See this post if you want to know more about events themselves.

Let’s have a look at the code below to see how to use event arguments.

Code:

Resulting output:

Share:

Leave a Reply

Your email address will not be published.

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.

Advertisment ad adsense adlogger