{"id":1218,"date":"2023-08-30T09:00:00","date_gmt":"2023-08-30T09:00:00","guid":{"rendered":"https:\/\/www.naveedulhaq.com\/?p=1218"},"modified":"2023-09-06T18:50:12","modified_gmt":"2023-09-06T18:50:12","slug":"mastering-c-sharp-events","status":"publish","type":"post","link":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/","title":{"rendered":"Mastering C# Events: A Guide to Effective Communication"},"content":{"rendered":"\n<p>In the dynamic realm of C# programming, events are powerful mechanisms that facilitate communication between different parts of your code. Events provide a means for objects to signal occurrences to which other objects can respond. This guide will explore the world of C# events, understanding their essence, implementation, and the scenarios where they truly shine.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"understanding-c-events\"><strong>Understanding C# Events<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Events Defined:<\/strong>&nbsp;In C#, an event is a construct that enables an object (the event source) to raise an event when a certain action or condition occurs. Other objects (the event listeners) can subscribe to these events and respond accordingly.<\/li>\n\n\n\n<li><strong>Event Publisher and Subscribers:<\/strong>&nbsp;The object that raises an event is called the \u201cevent publisher\u201d or \u201cevent source.\u201d Objects that listen and respond to events are known as \u201cevent subscribers\u201d or \u201clisteners.\u201d<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"declaring-an-event\"><strong>Declaring an Event<\/strong><\/h2>\n\n\n\n<p>To declare an event in C#, you use the&nbsp;<code>event<\/code>&nbsp;keyword along with a delegate type. This delegate type defines the signature of methods that can be subscribed to the event. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class TemperatureSensor\n{\n    public event EventHandler&lt;TemperatureChangedEventArgs&gt; TemperatureChanged;\n    \/\/ ...\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"built-in-eventhandler-delegate\"><strong>Built-in EventHandler Delegate<\/strong><\/h2>\n\n\n\n<p>In C#, the&nbsp;<code>EventHandler<\/code>&nbsp;delegate is a built-in delegate type that\u2019s often used with events. It simplifies the declaration of events by providing a consistent delegate signature for event handlers. The&nbsp;<code>EventHandler<\/code>&nbsp;delegate has the following signature:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public delegate void EventHandler&lt;TEventArgs&gt;(object sender, TEventArgs e);\n<\/code><\/pre>\n\n\n\n<p>This delegate takes two parameters: the&nbsp;<code>sender<\/code>, which is the object that raised the event, and the&nbsp;<code>e<\/code>&nbsp;of type&nbsp;<code>TEventArgs<\/code>, which holds any event-specific data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"implementing-c-events\"><strong>Implementing C# Events<\/strong><\/h2>\n\n\n\n<p>To create an event in C#, you need to follow a few key steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Declare the Event:<\/strong>&nbsp;Events are declared using the&nbsp;<code>event<\/code>&nbsp;keyword, followed by the delegate type that defines the signature of methods that can be subscribed to the event.<\/li>\n\n\n\n<li><strong>Define the Delegate:<\/strong>&nbsp;A delegate defines the signature of methods that can be subscribed to the event. It specifies the parameters and return type of the methods.<\/li>\n\n\n\n<li><strong>Add Event Handlers:<\/strong>&nbsp;Use the&nbsp;<code>+=<\/code>&nbsp;operator to add methods (event handlers) to the event\u2019s invocation list. These methods will be called when the event is raised.<\/li>\n\n\n\n<li><strong>Raise the Event:<\/strong>&nbsp;To raise an event, call the event with appropriate arguments. This triggers the execution of all subscribed event handlers.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"example-creating-and-raising-an-event\"><strong>Example: Creating and Raising an Event<\/strong><\/h2>\n\n\n\n<p>Let\u2019s consider a simple example where a&nbsp;<code>TemperatureSensor<\/code>&nbsp;class raises a&nbsp;<code>TemperatureChanged<\/code>&nbsp;event whenever the temperature changes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using System;\n\npublic class TemperatureChangedEventArgs : EventArgs\n{\n    public double NewTemperature { get; set; }\n}\n\npublic class TemperatureSensor\n{\n    public event EventHandler&lt;TemperatureChangedEventArgs&gt; TemperatureChanged;\n\n    private double _temperature;\n\n    public double Temperature\n    {\n        get { return _temperature; }\n        set\n        {\n            if (_temperature != value)\n            {\n                _temperature = value;\n                OnTemperatureChanged(new TemperatureChangedEventArgs { NewTemperature = value });\n            }\n        }\n    }\n\n    protected virtual void OnTemperatureChanged(TemperatureChangedEventArgs e)\n    {\n        TemperatureChanged?.Invoke(this, e);\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>In this example, the&nbsp;<code>TemperatureSensor<\/code>&nbsp;class declares a&nbsp;<code>TemperatureChanged<\/code>&nbsp;event. Whenever the&nbsp;<code>Temperature<\/code>&nbsp;property is set, the&nbsp;<code>OnTemperatureChanged<\/code>&nbsp;method is called, raising the event.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"subscribing-to-events\"><strong>Subscribing to Events<\/strong><\/h2>\n\n\n\n<p>Other classes can subscribe to events using event handlers. For instance, a&nbsp;<code>TemperatureDisplay<\/code>&nbsp;class might subscribe to the&nbsp;<code>TemperatureChanged<\/code>&nbsp;event to display the new temperature.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class TemperatureDisplay\n{\n    public TemperatureDisplay(TemperatureSensor sensor)\n    {\n        sensor.TemperatureChanged += Sensor_TemperatureChanged;\n    }\n\n    private void Sensor_TemperatureChanged(object sender, TemperatureChangedEventArgs e)\n    {\n        Console.WriteLine($\"Temperature changed: {e.NewTemperature}\");\n    }\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"benefits-of-c-events\"><strong>Benefits of C# Events<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Decoupling:<\/strong>&nbsp;Events facilitate loose coupling between components, allowing different parts of your code to communicate without being tightly integrated.<\/li>\n\n\n\n<li><strong>Extensibility:<\/strong>&nbsp;Events allow you to add new functionality to existing code by subscribing new event handlers, without modifying the existing code.<\/li>\n\n\n\n<li><strong>Modularity:<\/strong>&nbsp;With events, you can create modular and reusable components that can interact with each other through well-defined interfaces.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"real-world-scenario-gui-applications\"><strong>Real-World Scenario: GUI Applications<\/strong><\/h2>\n\n\n\n<p>C# events naturally fit in graphical user interface (GUI) applications. UI elements like buttons, text boxes, and checkboxes can raise events (such as&nbsp;<code>Click<\/code>,&nbsp;<code>TextChanged<\/code>, etc.), and other application parts can subscribe to these events to respond appropriately.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>C# events provide robust communication between different parts of your code. Understanding their essence and implementation allows you to create more modular, extensible, and decoupled applications. Events are particularly useful in scenarios where different components must respond to specific occurrences in a dynamic and asynchronous environment. Embrace the power of <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/csharp\/\" target=\"_blank\" rel=\"noreferrer noopener\">C#<\/a> events to enhance the interactivity and responsiveness of your<\/p>\n\n\n\n<p><a href=\"https:\/\/www.naveedulhaq.com\/index.php\/category\/dot-net-core\/\">Learn more C#\/.NET Tutorials Here!<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the dynamic realm of C# programming, events are powerful mechanisms that facilitate communication between different parts of your code. Events provide a means for&#8230;<\/p>\n","protected":false},"author":3,"featured_media":641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[11,8,62,32,23,56],"class_list":["post-1218","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dot-net-core","tag-dot-net-core","tag-dot-net-framework","tag-asp-net","tag-developer","tag-development","tag-visual-studio"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Mastering C# Events: A Guide to Effective Communication - Naveed Ul-Haq&#039;s blog<\/title>\n<meta name=\"description\" content=\"C# events provide robust communication between different parts of your code which allows you to create more modular, extensible applications.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mastering C# Events: A Guide to Effective Communication - Naveed Ul-Haq&#039;s blog\" \/>\n<meta property=\"og:description\" content=\"C# events provide robust communication between different parts of your code which allows you to create more modular, extensible applications.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/\" \/>\n<meta property=\"og:site_name\" content=\"Naveed Ul-Haq&#039;s blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-30T09:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-06T18:50:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png\" \/>\n\t<meta property=\"og:image:width\" content=\"240\" \/>\n\t<meta property=\"og:image:height\" content=\"240\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Abdul Mannan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abdul Mannan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/\"},\"author\":{\"name\":\"Abdul Mannan\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/8babf3cd198e47e5c727f67880ea7977\"},\"headline\":\"Mastering C# Events: A Guide to Effective Communication\",\"datePublished\":\"2023-08-30T09:00:00+00:00\",\"dateModified\":\"2023-09-06T18:50:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/\"},\"wordCount\":634,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"keywords\":[\".net core\",\".net framework\",\"asp.net\",\"developer\",\"development\",\"visual-studio\"],\"articleSection\":[\".NET\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/\",\"name\":\"Mastering C# Events: A Guide to Effective Communication - Naveed Ul-Haq&#039;s blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"datePublished\":\"2023-08-30T09:00:00+00:00\",\"dateModified\":\"2023-09-06T18:50:12+00:00\",\"description\":\"C# events provide robust communication between different parts of your code which allows you to create more modular, extensible applications.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"contentUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"width\":240,\"height\":240,\"caption\":\".net\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/mastering-c-sharp-events\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.naveedulhaq.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mastering C# Events: A Guide to Effective Communication\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#website\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/\",\"name\":\"Naveed Ul-Haq's blog\",\"description\":\"AI, Optimizely, Azure &amp; more\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.naveedulhaq.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\",\"name\":\"Naveed Ul-Haq\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"caption\":\"Naveed Ul-Haq\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\"},\"description\":\"I lead engineering delivery teams for digital commerce and digital experience platforms, combining hands-on architecture experience with strong delivery governance. Over 20+ years, I\u2019ve built and led cross\u2011functional teams (engineering, BA, QA) delivering modern cloud solutions on Azure, microservices, APIs and eCommerce\\\/CMS platforms. My recent focus includes AI-enabled commerce automation: product ingestion and enrichment workflows, content optimisation for SEO and shopping feeds, and agentic tooling to improve marketing and accessibility workflows. I\u2019m passionate about building high-performing teams, establishing quality\\\/release standards, and delivering measurable outcomes across performance, reliability, and speed of change.\",\"sameAs\":[\"https:\\\/\\\/www.naveedulhaq.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/naveedulhaq\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/8babf3cd198e47e5c727f67880ea7977\",\"name\":\"Abdul Mannan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g\",\"caption\":\"Abdul Mannan\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mastering C# Events: A Guide to Effective Communication - Naveed Ul-Haq&#039;s blog","description":"C# events provide robust communication between different parts of your code which allows you to create more modular, extensible applications.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/","og_locale":"en_GB","og_type":"article","og_title":"Mastering C# Events: A Guide to Effective Communication - Naveed Ul-Haq&#039;s blog","og_description":"C# events provide robust communication between different parts of your code which allows you to create more modular, extensible applications.","og_url":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/","og_site_name":"Naveed Ul-Haq&#039;s blog","article_published_time":"2023-08-30T09:00:00+00:00","article_modified_time":"2023-09-06T18:50:12+00:00","og_image":[{"width":240,"height":240,"url":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","type":"image\/png"}],"author":"Abdul Mannan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Abdul Mannan","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#article","isPartOf":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/"},"author":{"name":"Abdul Mannan","@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/8babf3cd198e47e5c727f67880ea7977"},"headline":"Mastering C# Events: A Guide to Effective Communication","datePublished":"2023-08-30T09:00:00+00:00","dateModified":"2023-09-06T18:50:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/"},"wordCount":634,"commentCount":0,"publisher":{"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9"},"image":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#primaryimage"},"thumbnailUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","keywords":[".net core",".net framework","asp.net","developer","development","visual-studio"],"articleSection":[".NET"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/","url":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/","name":"Mastering C# Events: A Guide to Effective Communication - Naveed Ul-Haq&#039;s blog","isPartOf":{"@id":"https:\/\/www.naveedulhaq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#primaryimage"},"image":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#primaryimage"},"thumbnailUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","datePublished":"2023-08-30T09:00:00+00:00","dateModified":"2023-09-06T18:50:12+00:00","description":"C# events provide robust communication between different parts of your code which allows you to create more modular, extensible applications.","breadcrumb":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#primaryimage","url":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","contentUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","width":240,"height":240,"caption":".net"},{"@type":"BreadcrumbList","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/mastering-c-sharp-events\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.naveedulhaq.com\/"},{"@type":"ListItem","position":2,"name":"Mastering C# Events: A Guide to Effective Communication"}]},{"@type":"WebSite","@id":"https:\/\/www.naveedulhaq.com\/#website","url":"https:\/\/www.naveedulhaq.com\/","name":"Naveed Ul-Haq's blog","description":"AI, Optimizely, Azure &amp; more","publisher":{"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.naveedulhaq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9","name":"Naveed Ul-Haq","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","caption":"Naveed Ul-Haq"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g"},"description":"I lead engineering delivery teams for digital commerce and digital experience platforms, combining hands-on architecture experience with strong delivery governance. Over 20+ years, I\u2019ve built and led cross\u2011functional teams (engineering, BA, QA) delivering modern cloud solutions on Azure, microservices, APIs and eCommerce\/CMS platforms. My recent focus includes AI-enabled commerce automation: product ingestion and enrichment workflows, content optimisation for SEO and shopping feeds, and agentic tooling to improve marketing and accessibility workflows. I\u2019m passionate about building high-performing teams, establishing quality\/release standards, and delivering measurable outcomes across performance, reliability, and speed of change.","sameAs":["https:\/\/www.naveedulhaq.com","https:\/\/www.linkedin.com\/in\/naveedulhaq\/"]},{"@type":"Person","@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/8babf3cd198e47e5c727f67880ea7977","name":"Abdul Mannan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g","caption":"Abdul Mannan"}}]}},"_links":{"self":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/comments?post=1218"}],"version-history":[{"count":0,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts\/1218\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/media\/641"}],"wp:attachment":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/media?parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/categories?post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/tags?post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}