---
title: "Events in C#"  
description: "Events in C#"  
author: "Anonymous User"  
published: 2015-12-21  
updated: 2015-12-21  
canonical: https://www.mindstick.com/forum/33767/events-in-c-sharp  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 1 minute  

---

# Events in C#

I want to use [Events in C#](https://www.mindstick.com/forum/159976/explain-the-concept-of-delegates-and-events-in-c-sharp) How to use this.

## Replies

### Reply by Anonymous User

An event can have many handlers. With the event handler syntax, we create a notification system. We attach additional methods without changing other parts of the code. This makes programs easier to maintain.

```
using System;namespace EventsInCSharp{    public class OurClass    {        public delegate void OurDelegate(string message);        public event OurDelegate OurEvent;                public void UseEvent(string message)        {            if (OurEvent != null)                OurEvent(message);        }    }    class Program    {        static void Main(string[] args)        {            GetReStart:            OurClass OurClass = new OurClass();            OurClass.OurEvent += new OurClass.OurDelegate(OurClass_MyEvent);            Console.WriteLine("Please enter your name\n");            string msg = Console.ReadLine();                       OurClass.UseEvent(msg);            goto GetReStart;              }                static void OurClass_MyEvent(string message)        {            Console.WriteLine("Your Name is: {0}", message);        }    }}
```

c![Events in C#](https://www.mindstick.com/mindstickforums/1118d60a-01cf-451d-9d05-43a8eec93fb5/images/99d3620f-7515-477d-8776-34fa71daf642.png)


---

Original Source: https://www.mindstick.com/forum/33767/events-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
