{"id":103871,"date":"2024-01-06T09:02:17","date_gmt":"2024-01-06T08:02:17","guid":{"rendered":"https:\/\/code-maze.com\/?p=103871"},"modified":"2024-01-06T09:02:17","modified_gmt":"2024-01-06T08:02:17","slug":"csharp-periodic-timer","status":"publish","type":"post","link":"https:\/\/code-maze.com\/csharp-periodic-timer\/","title":{"rendered":"PeriodicTimer in C#"},"content":{"rendered":"<p>Some system development problems may require us to perform tasks at regular intervals. Such tasks may include updating user interfaces and data or other recurring tasks. To ensure we address this need, C# provides the PeriodicTimer class, which was introduced in .NET 6.\u00a0<\/p>\n<p>In this article, we will delve into its functionalities and usage, exploring how it simplifies the implementation of periodic operations in C#.<\/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\/threads-csharp\/PeriodicTimerCSharp\" target=\"_blank\" rel=\"nofollow noopener\">GitHub repository<\/a>.<\/div>\n<p>Without further ado, let&#8217;s begin!<\/p>\n<h2><a id=\"how-it-works\"><\/a>How Does the PeriodicTimer Class Work in C#?<\/h2>\n<p>First, let&#8217;s define some variables, which we are going to use with our example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private readonly PeriodicTimer _periodicTimer;\r\nprivate readonly CancellationTokenSource _cancellationToken = new();\r\nprivate Task? _task;\r\nprivate int _size;<\/pre>\n<p>Here, we define a <code>PeriodicTimer<\/code> variable, which we will instantiate later. Also, we define and initialize a <code>CancellationTokenSource<\/code> variable, which comes in handy when defining the logic we are going to use to terminate a recurring nullable <code>Task<\/code>. Finally, since we want to create arrays of random numbers, the <code>_size<\/code> variable holds the number of elements we want to create.\u00a0\u00a0<\/p>\n<p>Second, let&#8217;s create a constructor to initialize our <code>_periodicTimer<\/code> and the <code>_size<\/code> of the arrays we want to create:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public PeriodicTimerMethods(TimeSpan timeSpan, int size) \r\n{\r\n    _periodicTimer = new PeriodicTimer(timeSpan);\r\n    _size = size;\r\n}<\/pre>\n<p>Next, let&#8217;s create a function to carry out a task, such as creating a random array of integers, which we need to time:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public static int[] CreateRandomArray(int size)\r\n{\r\n    var array = new int[size];\r\n\r\n    for (int i = 0; i &lt; size; i++)\r\n    {\r\n        array[i] = Random.Shared.Next();\r\n    }\r\n    \r\n    return array;\r\n}<\/pre>\n<p>The method returns an array of <a href=\"https:\/\/code-maze.com\/csharp-random-class\/\" target=\"_blank\" rel=\"noopener\">random<\/a> integers of a given size.\u00a0<\/p>\n<p>After that, let&#8217;s implement a method that invokes <code>CreateRandomArray()<\/code> and a <code>PeriodicTimer<\/code> instance:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private async Task RandomArrayTimerAsync() \r\n{\r\n    try \r\n    {\r\n        var stopWatch = System.Diagnostics.Stopwatch.StartNew();\r\n        var numberOfArrays = 1;\r\n\r\n        while (await _periodicTimer.WaitForNextTickAsync(_cancellationToken.Token)) \r\n        {\r\n            var array = CreateRandomArray(_size);\r\n\r\n            foreach (var item in array)\r\n            {\r\n                Console.WriteLine(item);\r\n            }\r\n\r\n            Console.WriteLine($\"Created {numberOfArrays++} arrays in {stopWatch.Elapsed.Seconds}s\");\r\n            Console.WriteLine(DateTime.Now.ToString(\"O\"));\r\n        }\r\n    }\r\n    catch(OperationCanceledException) \r\n    {\r\n    }\r\n}<\/pre>\n<p>Here, we want to check how many <code>CreateRandomArray()<\/code> instances we can create and display before the user cancels the task. The <code>WaitForNextTickAsnyc()<\/code> method waits for the next tick of the timer or for the timer to be terminated. Also, we define a <a href=\"https:\/\/code-maze.com\/csharp-stopwatch\/\" target=\"_blank\" rel=\"noopener\">Stopwatch<\/a> instance to track how long it takes to invoke the method and print its elements.\u00a0<\/p>\n<p>Next, let&#8217;s create two helper methods to initiate and terminate the task:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public void Start() \r\n{\r\n    _task = RandomArrayTimerAsync();\r\n}\r\n\r\npublic async Task StopTaskAsync() \r\n{\r\n    if (_task is null) \r\n    {\r\n        return;\r\n    }\r\n\r\n    _cancellationToken.Cancel();\r\n    await _task;\r\n    _cancellationToken.Dispose();\r\n    Console.WriteLine(\"The array task was canceled\");\r\n}<\/pre>\n<p>In the <code>StopTaskAsync()<\/code> method, we invoke the <code>Cancel()<\/code> method, which in turn sets the <code>IsCancellationRequested<\/code> property to <code>true<\/code>. We also allow any pending tasks to be completed before disposing of the object to free up resources.\u00a0<\/p>\n<p>In the main program, we can verify that our solution works as it should:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">Console.WriteLine(\"Enter array size\");\r\nvar numOfElements = Convert.ToInt32(Console.ReadLine());\r\n\r\nvar timerTask = new PeriodicTimerMethods(TimeSpan.FromSeconds(1), numOfElements);\r\ntimerTask.Start();\r\n\r\nConsole.WriteLine(\"Press any button to terminate the task\");\r\nConsole.ReadKey();\r\n\r\nawait timerTask.StopTaskAsync();<\/pre>\n<p>Finally, let&#8217;s see the program&#8217;s output when we execute it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">Enter array size\r\n5\r\nPress any button to terminate the task\r\n479374939\r\n697289253\r\n1550136409\r\n1551055180\r\n1617676033\r\nCreated 1 arrays in 1s\r\n2023-12-25T19:05:12.6925149+03:00\r\n2012005036\r\n84538657\r\n1290408908\r\n166230976\r\n1357829224\r\nCreated 2 arrays in 1s\r\n2023-12-25T19:05:13.6871240+03:00\r\n442474362\r\n1672553469\r\n935280249\r\n1896142986\r\n1107451607\r\nCreated 3 arrays in 3s\r\n2023-12-25T19:05:14.7019991+03:00\r\nThe array task was canceled<\/pre>\n<p>We can see that we can create random arrays and output them while displaying the elapsed time.\u00a0<\/p>\n<h2><a id=\"benefits\"><\/a>Why Use the PeriodicTimer in C#?<\/h2>\n<p>To start with, it is pretty <strong>simple to implement<\/strong>. The <code>PeriodicTimer<\/code> class achieves this by simplifying setting up and managing timers.<\/p>\n<p>On top of its simplicity, we can see that the <code>PeriodicTimer<\/code> class is beneficial because of its <strong>precise timing<\/strong>, as it maintains a more accurate interval between successive invocations than other timing mechanisms.\u00a0<\/p>\n<p>Finally, we can implement the <code>PeriodicTimer<\/code> class in situations where <strong>cancellation is critical<\/strong>. For example, we can cancel a timer before it completes its intended executions, i.e., when conditions change and we need to halt the operation.\u00a0<\/p>\n<h2><a id=\"timers\"><\/a>Other Timers in C#<\/h2>\n<p>Besides the <code>PeriodicTimer<\/code> class, other timer classes are also available in .NET. <a href=\"https:\/\/code-maze.com\/timer-csharp\/\" target=\"_blank\" rel=\"noopener\">System.Timers.Timer<\/a> class is event-based, generating an event after a set interval and providing options for creating recurring events. This class is ideal for creating server-based or service components that we intend to consume in multithreaded applications. Besides, the class has no user interface and is never visible at runtime.\u00a0<\/p>\n<p>Another timer in .NET is\u00a0<code>System.Threading.Timer<\/code> , which works by executing a single callback on a thread pool at regular intervals. We cannot alter the callback method when we instantiate the timer. Just like the <code>System.Timers.Timer<\/code> class, <code>System.Threading.Timer<\/code> is also ideal for server-based or service components in multithreaded applications. It doesn&#8217;t have a user interface and is never visible at runtime.<\/p>\n<p>The\u00a0<code>System.Windows.Forms.Timer<\/code> class is present in Windows Forms applications and fires events at regular intervals. Unlike the first two classes, this class is ideal for single-threaded environments. Finally, we can take advantage of the <code>System.Web.UI.Timer<\/code> class in Web UI applications, which initiates asynchronous or synchronous postbacks at set intervals.\u00a0<\/p>\n<p>The <code>PeriodicTimer<\/code> class is superior to these other classes, as it has <strong>specific support for cancellation<\/strong>. Besides, it does not rely on <strong>callbacks and is less susceptible to memory leaks<\/strong>, making it a natural pick over the other timers.\u00a0<\/p>\n<h2><a id=\"conclusion\"><\/a>Conclusion<\/h2>\n<p>In this article, we learn how to use the PeriodicTimer class in C#. Moreover, we can see that its simplicity, precise timing, and cancellation capabilities make it a valuable tool for scenarios requiring repetitive tasks. Have you implemented the PeriodicTimer class in your applications? Let us know in the comments section below.\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some system development problems may require us to perform tasks at regular intervals. Such tasks may include updating user interfaces and data or other recurring tasks. To ensure we address this need, C# provides the PeriodicTimer class, which was introduced in .NET 6.\u00a0 In this article, we will delve into its functionalities and usage, exploring [&hellip;]<\/p>\n","protected":false},"author":86,"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,1196],"class_list":["post-103871","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-csharp","tag-c","tag-timer","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>PeriodicTimer in C# - Code Maze<\/title>\n<meta name=\"description\" content=\"In this article, we will learn how to use PeriodicTimer class in order to perform tasks in regular time intervals in C#.\" \/>\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-periodic-timer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PeriodicTimer in C# - Code Maze\" \/>\n<meta property=\"og:description\" content=\"In this article, we will learn how to use PeriodicTimer class in order to perform tasks in regular time intervals in C#.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/csharp-periodic-timer\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-06T08:02:17+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=\"Martin Chege\" \/>\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=\"Martin Chege\" \/>\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-periodic-timer\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/\"},\"author\":{\"name\":\"Martin Chege\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/8daa4ece00dab067188d2269f4ab2985\"},\"headline\":\"PeriodicTimer in C#\",\"datePublished\":\"2024-01-06T08:02:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/\"},\"wordCount\":733,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"keywords\":[\"C#\",\"Timer\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/csharp-periodic-timer\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/\",\"url\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/\",\"name\":\"PeriodicTimer in C# - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"datePublished\":\"2024-01-06T08:02:17+00:00\",\"description\":\"In this article, we will learn how to use PeriodicTimer class in order to perform tasks in regular time intervals in C#.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/csharp-periodic-timer\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/csharp-periodic-timer\/#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-periodic-timer\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PeriodicTimer 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\/8daa4ece00dab067188d2269f4ab2985\",\"name\":\"Martin Chege\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Martin-Chege-400px-150x150.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Martin-Chege-400px-150x150.png\",\"caption\":\"Martin Chege\"},\"description\":\"Martin has over seven years of experience designing, and developing .NET web applications. His experience includes building electronic health record systems. Besides his every-day job as a cyber security professional, he enjoys learning new technologies and contributing to discussion forums.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/martin-c-02554872\/\"],\"url\":\"https:\/\/code-maze.com\/author\/martinchege\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PeriodicTimer in C# - Code Maze","description":"In this article, we will learn how to use PeriodicTimer class in order to perform tasks in regular time intervals in C#.","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-periodic-timer\/","og_locale":"en_US","og_type":"article","og_title":"PeriodicTimer in C# - Code Maze","og_description":"In this article, we will learn how to use PeriodicTimer class in order to perform tasks in regular time intervals in C#.","og_url":"https:\/\/code-maze.com\/csharp-periodic-timer\/","og_site_name":"Code Maze","article_published_time":"2024-01-06T08:02:17+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":"Martin Chege","twitter_card":"summary_large_image","twitter_creator":"@CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Martin Chege","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/"},"author":{"name":"Martin Chege","@id":"https:\/\/code-maze.com\/#\/schema\/person\/8daa4ece00dab067188d2269f4ab2985"},"headline":"PeriodicTimer in C#","datePublished":"2024-01-06T08:02:17+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/"},"wordCount":733,"commentCount":0,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","keywords":["C#","Timer"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/csharp-periodic-timer\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/","url":"https:\/\/code-maze.com\/csharp-periodic-timer\/","name":"PeriodicTimer in C# - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","datePublished":"2024-01-06T08:02:17+00:00","description":"In this article, we will learn how to use PeriodicTimer class in order to perform tasks in regular time intervals in C#.","breadcrumb":{"@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/csharp-periodic-timer\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/csharp-periodic-timer\/#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-periodic-timer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"PeriodicTimer 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\/8daa4ece00dab067188d2269f4ab2985","name":"Martin Chege","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Martin-Chege-400px-150x150.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/05\/Martin-Chege-400px-150x150.png","caption":"Martin Chege"},"description":"Martin has over seven years of experience designing, and developing .NET web applications. His experience includes building electronic health record systems. Besides his every-day job as a cyber security professional, he enjoys learning new technologies and contributing to discussion forums.","sameAs":["https:\/\/www.linkedin.com\/in\/martin-c-02554872\/"],"url":"https:\/\/code-maze.com\/author\/martinchege\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/103871","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\/86"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=103871"}],"version-history":[{"count":2,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/103871\/revisions"}],"predecessor-version":[{"id":103873,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/103871\/revisions\/103873"}],"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=103871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=103871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=103871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}