{"id":77815,"date":"2022-12-05T07:30:37","date_gmt":"2022-12-05T06:30:37","guid":{"rendered":"https:\/\/drafts.code-maze.com\/?p=77477"},"modified":"2022-12-08T20:28:45","modified_gmt":"2022-12-08T19:28:45","slug":"enumerate-enum-csharp","status":"publish","type":"post","link":"https:\/\/code-maze.com\/enumerate-enum-csharp\/","title":{"rendered":"How to Enumerate an Enum in C#"},"content":{"rendered":"<p>In this article, we&#8217;re going to look at some of the ways we can enumerate an Enum in C#. <a href=\"https:\/\/code-maze.com\/csharp-enumerations\" target=\"_blank\" rel=\"noopener\">Enums<\/a> allow us to declare a group of related constant values in a readable way where the underlying data type is usually an integer.\u00a0<\/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-intermediate-topics\/EnumerateAnEnumInCSharp\" target=\"_blank\" rel=\"nofollow noopener\">GitHub repository<\/a>.<\/div>\n<p>Let&#8217;s start.<\/p>\n<h2>Creating an Example Enum<\/h2>\n<p>Let&#8217;s start by creating an enumeration we can use throughout the rest of this article:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">internal enum DayOfWeek\r\n{\r\n    Monday,\r\n    Tuesday,\r\n    Wednesday,\r\n    Thursday,\r\n    Friday,\r\n    Saturday,\r\n    Sunday\r\n}<\/pre>\n<p>We&#8217;ve made an enumeration called <code>DayOfWeek<\/code> where each value is one of the days of the week.<\/p>\n<h2>How to Enumerate Using Enum.GetValues(Type type)<\/h2>\n<p>Before we enumerate our <code>DayOfWeek<\/code> enum we need to get the values into an enumerable type. Fortunately, there&#8217;s a handy static method on the <code>Enum<\/code> class that allows us to get the values of an enumeration into an <code>Array<\/code> object:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">var daysOfWeek = Enum.GetValues(typeof(DayOfWeek));<\/code><\/p>\n<p>The return value of the method <code>Enum.GetValues(Type type)<\/code> is <code>Array<\/code>.\u00a0<\/p>\n<p>Now we can loop through the values in that array and do something with each value:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">foreach (var dayOfWeek in daysOfWeek)\r\n{\r\n    Console.WriteLine(dayOfWeek);\r\n}<\/pre>\n<p>The below output will be the result:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">Monday\r\nTuesday\r\nWednesday\r\nThursday\r\nFriday\r\nSaturday\r\nSunday<\/pre>\n<p>The application prints out the name of the constants. This is because the result of <code>Enum.GetValues(Type type)<\/code> is an <code>Array<\/code> object which holds an array of type <code>object<\/code>. When we <code>Console.WriteLine()<\/code> with an <code>object<\/code> type, the <code>ToString()<\/code> method is what&#8217;s used.<\/p>\n<p>To get the integer value of each enumeration value we can cast the value of <code>dayofWeek<\/code> to an <code>int<\/code>:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">Console.WriteLine((int)dayOfWeek);<\/code><\/p>\n<p>Alternatively, we can specify that we want <code>dayOfWeek<\/code> to be an <code>int<\/code> when we declare it in our loop:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">foreach (int dayOfWeek in daysOfWeekValues)\r\n{\r\n    Console.WriteLine(dayOfWeek);\r\n}<\/pre>\n<p>This will produce an output in the console:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">0\r\n1\r\n2\r\n3\r\n4\r\n5\r\n6<\/pre>\n<h2>How to Enumerate Using Enum.GetValues&lt;TEnum&gt;()<\/h2>\n<p>Since .NET 5, there has been another version of the <code>Enum.GetValues<\/code> method and this one is a generic method.<\/p>\n<p>Instead of calling <code>Enum.GetValues(Type type)<\/code> and passing in the type of our enumeration using the <code>typeof<\/code> keyword, we can pass our <code>DayOfWeek<\/code> enumeration as a type parameter:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">var daysOfWeek = Enum.GetValues&lt;DayOfWeek&gt;();<\/code><\/p>\n<p>By calling Enum.GetValues this way, the return type is an <code>IEnumerable&lt;DayOfWeek&gt;<\/code> so we don&#8217;t need to do any casting. Our <code>daysOfWeek<\/code> variable is now implicitly of type <code>IEnumerable&lt;DayOfWeek&gt;<\/code>.<\/p>\n<p>We can loop through this in the same way that we have before:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">foreach (var dayOfWeek in Enum.GetValues&lt;DayOfWeek&gt;())\r\n{\r\n    Console.WriteLine($\"{dayOfWeek} = {(int)dayOfWeek}\");\r\n}<\/pre>\n<p>And, let&#8217;s inspect the output:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">Monday = 0\r\nTuesday = 1\r\nWednesday = 2\r\nThursday = 3\r\nFriday = 4\r\nSaturday = 5\r\nSunday = 6<\/pre>\n<h2>How to Enumerate an Enum Using Reflection<\/h2>\n<p>Using <a href=\"https:\/\/code-maze.com\/csharp-reflection\/\" target=\"_blank\" rel=\"noopener\">reflection in C#<\/a> should always be done with a lot of care because it can be very CPU-intensive and not something that you would typically want to do a lot of. In any case, we can use reflection to enumerate our <code>DayOfWeek<\/code> enumeration.<\/p>\n<p>First, we want to get the field information for our enumeration:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">FieldInfo[] fields = typeof(DayOfWeek).GetFields(BindingFlags.Static | BindingFlags.Public);<\/code><\/p>\n<p>This will give us a <code>FieldInfo<\/code> for each of the enumeration values. Now we&#8217;ll use LINQ to:<\/p>\n<ul>\n<li>Select the value of <code>GetValue(null)<\/code><\/li>\n<li>Cast each object result to our enumeration type<\/li>\n<li>Return the results as an array<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public static TEnum[] GetValuesWithReflection&lt;TEnum&gt;() where TEnum : Enum\r\n{\r\n    FieldInfo[] fields = typeof(TEnum).GetFields(BindingFlags.Static | BindingFlags.Public);\r\n\r\n    return fields.Select(x =&gt; x.GetValue(null))\r\n        .Cast&lt;TEnum&gt;()\r\n        .ToArray();\r\n}<\/pre>\n<h3>Reflection With GetEnumValues() or GetEnumNames() Methods<\/h3>\n<p>We can also use the inbuilt methods <code>Type.GetEnumValues()<\/code> or <code>Type.GetEnumNames()<\/code> to get the same result:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">Type dayOfWeekEnum = typeof(DayOfWeek);\r\nvar values = dayOfWeekEnum.GetEnumValues();\r\nforeach (var value in values)\r\n{\r\n    Console.WriteLine(value);\r\n}\r\n\r\nvar names = dayOfWeekEnum.GetEnumNames();\r\nforeach (var name in names)\r\n{\r\n    Console.WriteLine(name);\r\n}<\/pre>\n<p>This results in the same exact output.<\/p>\n<h2>How Should We Enumerate Enums in C#?<\/h2>\n<p><strong>The best way to enumerate over the values of an enumeration if you are using .NET 5 or higher would be to use the generic<\/strong> <code>Enum.GetValues&lt;T&gt;()<\/code><strong> method.<\/strong> This is a really handy method because it already returns the result as an <code>IEnumerable<\/code> collection of your enumeration&#8217;s type.<\/p>\n<p>If you are using an <strong>earlier version of .NET that doesn&#8217;t support the generic <code>Enum.GetValues&lt;T&gt;()<\/code> method, the best option would be to use the<\/strong> <code>Enum.GetValues(Type type)<\/code><strong> method<\/strong> to get the enumeration values as an <code>Array<\/code> object. Then we can cast it to an array of enumeration types.<\/p>\n<p>We <strong>recommend against using reflection<\/strong> to enumerate an <code>enum<\/code> unless the other two options can&#8217;t be used. If reflection has to be used to enumerate an <code>enum<\/code> then we would strongly recommend using a caching strategy so the conversion doesn&#8217;t have to be done over and over again as it can be very expensive.\u00a0<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, we&#8217;ve learned how to enumerate an <code>enum<\/code> in C#. We&#8217;ve learned how to get an <code>enum<\/code> into an enumerable type in .NET versions older than .NET 5 and newer so that we can do what we want with each possible value of the <code>enum<\/code>.<\/p>\n<p>Finally, we&#8217;ve shown how we can use reflection to enumerate an enumeration. However, we don&#8217;t recommend using reflection more than we require it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we&#8217;re going to look at some of the ways we can enumerate an Enum in C#. Enums allow us to declare a group of related constant values in a readable way where the underlying data type is usually an integer.\u00a0 Let&#8217;s start. Creating an Example Enum Let&#8217;s start by creating an enumeration [&hellip;]<\/p>\n","protected":false},"author":6,"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":[1143,1530,1390],"class_list":["post-77815","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-csharp","tag-enum","tag-enumerate-enum","tag-enumeration","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>How to Enumerate an Enum in C# - Code Maze<\/title>\n<meta name=\"description\" content=\"We&#039;re going to look at some of the ways we can enumerate an Enum in C#. Enums allow us to declare a group of related constant values.\" \/>\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\/enumerate-enum-csharp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Enumerate an Enum in C# - Code Maze\" \/>\n<meta property=\"og:description\" content=\"We&#039;re going to look at some of the ways we can enumerate an Enum in C#. Enums allow us to declare a group of related constant values.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/enumerate-enum-csharp\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-05T06:30:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-08T19:28:45+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=\"Code Maze\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/CodeMazeBlog\" \/>\n<meta name=\"twitter:site\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Code Maze\" \/>\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\/enumerate-enum-csharp\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/\"},\"author\":{\"name\":\"Code Maze\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04\"},\"headline\":\"How to Enumerate an Enum in C#\",\"datePublished\":\"2022-12-05T06:30:37+00:00\",\"dateModified\":\"2022-12-08T19:28:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/\"},\"wordCount\":696,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"keywords\":[\"enum\",\"Enumerate enum\",\"Enumeration\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/enumerate-enum-csharp\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/\",\"url\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/\",\"name\":\"How to Enumerate an Enum in C# - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"datePublished\":\"2022-12-05T06:30:37+00:00\",\"dateModified\":\"2022-12-08T19:28:45+00:00\",\"description\":\"We're going to look at some of the ways we can enumerate an Enum in C#. Enums allow us to declare a group of related constant values.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/enumerate-enum-csharp\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/enumerate-enum-csharp\/#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\/enumerate-enum-csharp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Enumerate an Enum 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\/09d29b223012c8e94a68ba62861d0b04\",\"name\":\"Code Maze\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png\",\"caption\":\"Code Maze\"},\"description\":\"This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/codemaze\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog\"],\"url\":\"https:\/\/code-maze.com\/author\/codemazecontributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Enumerate an Enum in C# - Code Maze","description":"We're going to look at some of the ways we can enumerate an Enum in C#. Enums allow us to declare a group of related constant values.","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\/enumerate-enum-csharp\/","og_locale":"en_US","og_type":"article","og_title":"How to Enumerate an Enum in C# - Code Maze","og_description":"We're going to look at some of the ways we can enumerate an Enum in C#. Enums allow us to declare a group of related constant values.","og_url":"https:\/\/code-maze.com\/enumerate-enum-csharp\/","og_site_name":"Code Maze","article_published_time":"2022-12-05T06:30:37+00:00","article_modified_time":"2022-12-08T19:28:45+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":"Code Maze","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Code Maze","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/"},"author":{"name":"Code Maze","@id":"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04"},"headline":"How to Enumerate an Enum in C#","datePublished":"2022-12-05T06:30:37+00:00","dateModified":"2022-12-08T19:28:45+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/"},"wordCount":696,"commentCount":0,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","keywords":["enum","Enumerate enum","Enumeration"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/enumerate-enum-csharp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/","url":"https:\/\/code-maze.com\/enumerate-enum-csharp\/","name":"How to Enumerate an Enum in C# - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","datePublished":"2022-12-05T06:30:37+00:00","dateModified":"2022-12-08T19:28:45+00:00","description":"We're going to look at some of the ways we can enumerate an Enum in C#. Enums allow us to declare a group of related constant values.","breadcrumb":{"@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/enumerate-enum-csharp\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/enumerate-enum-csharp\/#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\/enumerate-enum-csharp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"How to Enumerate an Enum 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\/09d29b223012c8e94a68ba62861d0b04","name":"Code Maze","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png","caption":"Code Maze"},"description":"This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.","sameAs":["https:\/\/www.linkedin.com\/company\/codemaze\/","https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog"],"url":"https:\/\/code-maze.com\/author\/codemazecontributor\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/77815","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\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=77815"}],"version-history":[{"count":6,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/77815\/revisions"}],"predecessor-version":[{"id":78359,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/77815\/revisions\/78359"}],"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=77815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=77815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=77815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}