{"id":117028,"date":"2024-06-11T08:41:43","date_gmt":"2024-06-11T06:41:43","guid":{"rendered":"https:\/\/code-maze.com\/?p=117028"},"modified":"2024-06-11T08:41:43","modified_gmt":"2024-06-11T06:41:43","slug":"csharp-weak-events","status":"publish","type":"post","link":"https:\/\/code-maze.com\/csharp-weak-events\/","title":{"rendered":"Weak Events in C#"},"content":{"rendered":"<p>We use weak events in C# to avoid memory leaks in event-based applications. Let&#8217;s learn more about weak events, why they&#8217;re needed, and how to implement them.<\/p>\n<div style=\"padding: 20px; border-left: 5px #dc2323 solid; display: block; margin-bottom: 20px; box-shadow: 1px 1px 5px 0px lightgrey;\">To download the source code for this article, you can visit our <a href=\"https:\/\/github.com\/CodeMazeBlog\/CodeMazeGuides\/tree\/main\/csharp-advanced-topics\/WeakEventsInCSharp\" target=\"_blank\" rel=\"nofollow noopener\">GitHub repository<\/a>.<\/div>\n<p>Let&#8217;s get started.<\/p>\n<h2><a id=\"strongvweak\"><\/a>What Are Strong and Weak Events?<\/h2>\n<p>A strong <a href=\"https:\/\/code-maze.com\/csharp-events\/\" target=\"_blank\" rel=\"noopener\">event<\/a> is the default implementation of an event in C#. It enables an object to notify other objects when a change occurs.\u00a0<\/p>\n<p>Let&#8217;s see it in action by creating a <code>Publisher<\/code> class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class Publisher\r\n{\r\n    public event EventHandler? Event;\r\n\r\n    public void RaiseEvent()\r\n    {\r\n        Event?.Invoke(this, EventArgs.Empty);\r\n    }\r\n}<\/pre>\n<p>Now, let&#8217;s create a <code>Subscriber<\/code> class to subscribe to the <code>Event<\/code>\u00a0event:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class Subscriber\r\n{\r\n    public void HandleEvent(object sender, EventArgs e)\r\n    {\r\n        Console.WriteLine(\"Event received.\");\r\n    }\r\n}<\/pre>\n<p><strong>When subscribing to the event, we create a strong reference between the publisher and the subscriber. This strong reference doesn&#8217;t allow the <a href=\"https:\/\/code-maze.com\/csharp-managed-vs-unmanaged-code-garbage-collection\/\" target=\"_blank\" rel=\"noopener\">garbage collector (GC)<\/a> to collect the subscriber object as the publisher is still alive (i.e. GC hasn&#8217;t collected it).\u00a0<\/strong><\/p>\n<p>On the other hand, <strong>when creating a weak event, the event handler creates a weak reference between the publisher and the subscriber. A weak reference allows the GC to collect the object if there are no other strong references to it.<\/strong><\/p>\n<p>When we raise an event, the weak reference is checked to see if the target (subscriber) is still alive. If it is, the application invokes the event handler. However, if the target has been collected, the weak reference is removed from the list of event handlers.<\/p>\n<h2><a id=\"need\"><\/a>Why Do We Need Weak Events?<\/h2>\n<p>To understand why we need weak events, we need to review our default implementation of an event.<\/p>\n<p>Let&#8217;s imagine a data provider service that raises periodic events to update a part of the application UI. The <code>Publisher<\/code> class could represent this service while the <code>Subscriber<\/code> class would represent the UI components.<\/p>\n<p>When these UI components subscribe to the service\u2019s events, the service holds a strong reference to the event handlers in each UI component. If we assume a user can remove these UI components on demand, we&#8217;d expect the GC to free up the memory when these components are no longer needed.<\/p>\n<p>However, due to the strong references held by the service, the GC can&#8217;t reclaim the memory used by these UI components. This leads to a memory leak:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">var publisher = new Publisher();\r\nvar subscriber = new Subscriber();\r\n\r\npublisher.Event += subscriber.HandleEvent;\r\npublisher.RaiseEvent();\r\nsubscriber = null;\r\n\r\nGC.Collect();\r\n\r\npublisher.RaiseEvent();<\/pre>\n<p>Here, we&#8217;ve explicitly set the <code>subscriber<\/code> object to <code>null<\/code> to simulate a component removal. Then, we force garbage collection using the <code>GC.Collect()<\/code> method. However, it&#8217;s still not eligible for garbage collection as <code>publisher<\/code> holds a strong reference to it.<\/p>\n<p>When we run the application, it raises the event even after the garbage collection process:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">Event received.\r\nEvent received.<\/pre>\n<p><strong>By using weak references instead, we ensure that the event subscription does not prevent the garbage collection of the subscriber.<\/strong> Thus, weak events help manage memory more efficiently by ensuring that objects are collected as soon as they are no longer needed.<\/p>\n<h2><a id=\"implemenation\"><\/a>How to Implement Weak Events<\/h2>\n<p>We can use the <code>WeakReference<\/code> class to implement a weak event mechanism. The <code>WeakReference<\/code> class holds a weak reference to an object. This ensures that the application doesn&#8217;t prevent the garbage collector from collecting the object if there are no other strong references to it.<\/p>\n<p>Let&#8217;s create a <code>WeakEvent<\/code> class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class WeakEvent&lt;TEventArgs&gt; where TEventArgs : EventArgs\r\n{\r\n    private readonly List&lt;WeakReference&lt;EventHandler&lt;TEventArgs&gt;&gt;&gt; _eventHandlers = [];\r\n}<\/pre>\n<p>The <span style=\"color: #222222; font-family: monospace;\"><span style=\"background-color: #e9ebec;\">_eventHandlers<\/span><\/span> field maintains a list of weak references to event handlers. It allows subscribers to subscribe to events raised by publishers without creating strong references between them:<\/p>\n<p>Next, let&#8217;s add an <code>AddEventHandler()<\/code> method to add event handlers in this class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public void AddEventHandler(EventHandler&lt;TEventArgs&gt; handler)\r\n{\r\n    if (handler == null) return;\r\n\r\n    _eventHandlers.Add(new WeakReference&lt;EventHandler&lt;TEventArgs&gt;&gt;(handler));\r\n}<\/pre>\n<p>And another <code>RemoveEventHandler()<\/code> method to remove event handlers:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public void RemoveEventHandler(EventHandler&lt;TEventArgs&gt; handler)\r\n{\r\n    var eventHandler = _eventHandlers.FirstOrDefault(wr =&gt;\r\n    {\r\n        wr.TryGetTarget(out var target);\r\n\r\n        return target == handler;\r\n    });\r\n\r\n    if (eventHandler != null)\r\n    {\r\n        _eventHandlers.Remove(eventHandler);\r\n    }\r\n}<\/pre>\n<p>Finally, let&#8217;s add a<code>RaiseEvent()<\/code> method:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public void RaiseEvent(object sender, TEventArgs e)\r\n{\r\n    foreach (var eventHandler in _eventHandlers.ToArray())\r\n    {\r\n        if (eventHandler.TryGetTarget(out var handler))\r\n        {\r\n            handler(sender, e);\r\n        }\r\n    }\r\n}<\/pre>\n<p>This method triggers the event by invoking all the subscribed event handlers. We&#8217;re using the <code>TryGetTarget()<\/code> method to retrieve the target event handler. If successful, it invokes the event handler with the provided sender and event arguments.<\/p>\n<p>Now let&#8217;s create a <code>WeakReferenceSubscriber<\/code> class that&#8217;ll act as our subscriber:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class WeakReferenceSubscriber\r\n{\r\n    public void Subscribe(WeakReferencePublisher publisher)\r\n    {\r\n        publisher.Event.AddEventHandler(HandleEvent);\r\n    }\r\n\r\n    public void HandleEvent(object? sender, EventArgs e)\r\n    {\r\n        Console.WriteLine(\"Weak Event received.\");\r\n    }\r\n}<\/pre>\n<p>This will subscribe to the <code>WeakReferencePublisher<\/code> class:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class WeakReferencePublisher\r\n{\r\n    public WeakEvent&lt;EventArgs&gt; Event { get; } = new WeakEvent&lt;EventArgs&gt;();\r\n\r\n    public void RaiseEvent()\r\n    {\r\n        Event.RaiseEvent(this, EventArgs.Empty);\r\n    }\r\n}<\/pre>\n<p>Now, if we try to raise an event after removing the subscriber, the application doesn&#8217;t raise the latter event:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">var weakEventPublisher = new WeakReferencePublisher();\r\nvar weakEventSubscriber = new WeakReferenceSubscriber();\r\n\r\nweakEventSubscriber.Subscribe(weakEventPublisher);\r\nweakEventPublisher.RaiseEvent();\r\nweakEventSubscriber = null;\r\n\r\nGC.Collect();\r\n\r\nweakEventPublisher.RaiseEvent();<\/pre>\n<p>The weak reference allows the GC to collect the subscriber objects that are no longer alive:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">Weak Event received.<\/code><\/p>\n<p>This prevents the memory leaks we were facing with the default implementation of events.<\/p>\n<h2><a id=\"conclusion\"><\/a>Conclusion<\/h2>\n<p>In this article, we learned about weak events in C#. We saw how they provide a way to handle events without creating strong references. By using weak references, we can ensure that the garbage collector removes subscribers from memory when not needed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We use weak events in C# to avoid memory leaks in event-based applications. Let&#8217;s learn more about weak events, why they&#8217;re needed, and how to implement them. Let&#8217;s get started. What Are Strong and Weak Events? A strong event is the default implementation of an event in C#. It enables an object to notify other [&hellip;]<\/p>\n","protected":false},"author":160,"featured_media":62189,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[12],"tags":[1811,931,2213],"class_list":["post-117028","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-csharp","tag-c","tag-events","tag-weak-events","et-has-post-format-content","et_post_format-et-post-format-standard"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Weak Events in C# - Code Maze<\/title>\n<meta name=\"description\" content=\"Weak events in C# are used to prevent memory leaks in event-driven applications. Let&#039;s explore weak events and how to implement them.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/code-maze.com\/csharp-weak-events\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Weak Events in C# - Code Maze\" \/>\n<meta property=\"og:description\" content=\"Weak events in C# are used to prevent memory leaks in event-driven applications. Let&#039;s explore weak events and how to implement them.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/csharp-weak-events\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2024-06-11T06:41:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"620\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Satya Prakash\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:site\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Satya Prakash\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/\"},\"author\":{\"name\":\"Satya Prakash\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/20cdbb4ac1a89e179194505db3eab0e7\"},\"headline\":\"Weak Events in C#\",\"datePublished\":\"2024-06-11T06:41:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/\"},\"wordCount\":720,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"keywords\":[\"C#\",\"events\",\"weak events\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/csharp-weak-events\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/\",\"url\":\"https:\/\/code-maze.com\/csharp-weak-events\/\",\"name\":\"Weak Events in C# - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"datePublished\":\"2024-06-11T06:41:43+00:00\",\"description\":\"Weak events in C# are used to prevent memory leaks in event-driven applications. Let's explore weak events and how to implement them.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/csharp-weak-events\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"width\":1100,\"height\":620,\"caption\":\"C# Development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/code-maze.com\/csharp-weak-events\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Weak Events in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/code-maze.com\/#website\",\"url\":\"https:\/\/code-maze.com\/\",\"name\":\"Code Maze\",\"description\":\"Learn. Code. Succeed.\",\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/code-maze.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/code-maze.com\/#organization\",\"name\":\"Code Maze\",\"url\":\"https:\/\/code-maze.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"width\":3511,\"height\":3510,\"caption\":\"Code Maze\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/CodeMazeBlog\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/20cdbb4ac1a89e179194505db3eab0e7\",\"name\":\"Satya Prakash\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Satya-Prakash-400px-150x150.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Satya-Prakash-400px-150x150.png\",\"caption\":\"Satya Prakash\"},\"description\":\"Satya is a seasoned full-stack developer with over 8 years of software development experience specializing in C#, JavaScript, Angular, and SQL. He has developed robust web applications and services, leveraging the .NET framework for backend development while integrating frontend frameworks to create dynamic user interfaces. Satya has a proven track record of leading successful projects, collaborating effectively with cross-functional teams, and delivering high-quality solutions. Committed to staying updated with the latest industry trends, he is passionate about leveraging his expertise to tackle complex challenges and contribute meaningfully to impactful projects.\",\"url\":\"https:\/\/code-maze.com\/author\/satya-prakash\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Weak Events in C# - Code Maze","description":"Weak events in C# are used to prevent memory leaks in event-driven applications. Let's explore weak events and how to implement them.","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:\/\/code-maze.com\/csharp-weak-events\/","og_locale":"en_US","og_type":"article","og_title":"Weak Events in C# - Code Maze","og_description":"Weak events in C# are used to prevent memory leaks in event-driven applications. Let's explore weak events and how to implement them.","og_url":"https:\/\/code-maze.com\/csharp-weak-events\/","og_site_name":"Code Maze","article_published_time":"2024-06-11T06:41:43+00:00","og_image":[{"width":1100,"height":620,"url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","type":"image\/png"}],"author":"Satya Prakash","twitter_card":"summary_large_image","twitter_creator":"@CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Satya Prakash","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/csharp-weak-events\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/csharp-weak-events\/"},"author":{"name":"Satya Prakash","@id":"https:\/\/code-maze.com\/#\/schema\/person\/20cdbb4ac1a89e179194505db3eab0e7"},"headline":"Weak Events in C#","datePublished":"2024-06-11T06:41:43+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/csharp-weak-events\/"},"wordCount":720,"commentCount":0,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","keywords":["C#","events","weak events"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/csharp-weak-events\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/csharp-weak-events\/","url":"https:\/\/code-maze.com\/csharp-weak-events\/","name":"Weak Events in C# - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","datePublished":"2024-06-11T06:41:43+00:00","description":"Weak events in C# are used to prevent memory leaks in event-driven applications. Let's explore weak events and how to implement them.","breadcrumb":{"@id":"https:\/\/code-maze.com\/csharp-weak-events\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/csharp-weak-events\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/csharp-weak-events\/#primaryimage","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","width":1100,"height":620,"caption":"C# Development"},{"@type":"BreadcrumbList","@id":"https:\/\/code-maze.com\/csharp-weak-events\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"Weak Events in C#"}]},{"@type":"WebSite","@id":"https:\/\/code-maze.com\/#website","url":"https:\/\/code-maze.com\/","name":"Code Maze","description":"Learn. Code. Succeed.","publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/code-maze.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/code-maze.com\/#organization","name":"Code Maze","url":"https:\/\/code-maze.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","width":3511,"height":3510,"caption":"Code Maze"},"image":{"@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/CodeMazeBlog"]},{"@type":"Person","@id":"https:\/\/code-maze.com\/#\/schema\/person\/20cdbb4ac1a89e179194505db3eab0e7","name":"Satya Prakash","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Satya-Prakash-400px-150x150.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Satya-Prakash-400px-150x150.png","caption":"Satya Prakash"},"description":"Satya is a seasoned full-stack developer with over 8 years of software development experience specializing in C#, JavaScript, Angular, and SQL. He has developed robust web applications and services, leveraging the .NET framework for backend development while integrating frontend frameworks to create dynamic user interfaces. Satya has a proven track record of leading successful projects, collaborating effectively with cross-functional teams, and delivering high-quality solutions. Committed to staying updated with the latest industry trends, he is passionate about leveraging his expertise to tackle complex challenges and contribute meaningfully to impactful projects.","url":"https:\/\/code-maze.com\/author\/satya-prakash\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/117028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/users\/160"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=117028"}],"version-history":[{"count":1,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/117028\/revisions"}],"predecessor-version":[{"id":117029,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/117028\/revisions\/117029"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media\/62189"}],"wp:attachment":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media?parent=117028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=117028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=117028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}