{"id":101303,"date":"2023-12-11T01:35:23","date_gmt":"2023-12-11T00:35:23","guid":{"rendered":"https:\/\/drafts.code-maze.com\/?p=96266"},"modified":"2023-12-11T01:35:23","modified_gmt":"2023-12-11T00:35:23","slug":"csharp-tuple-aliases","status":"publish","type":"post","link":"https:\/\/code-maze.com\/csharp-tuple-aliases\/","title":{"rendered":"Tuple Aliases in C#"},"content":{"rendered":"<p>In this article, we will take an in-depth look at tuple aliases: what they are, how to use them, and the different rules that apply to them.\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\/TupleAliasInCSharp\" target=\"_blank\" rel=\"nofollow noopener\">GitHub repository<\/a>.<\/div>\n<p>Now let&#8217;s dig in!<\/p>\n<h2>What Are Tuples in C#?<\/h2>\n<p><a href=\"https:\/\/code-maze.com\/csharp-tuple\/\" target=\"_blank\" rel=\"noopener\">Tuples in C#<\/a> are lightweight data structures that store related data elements. A tuple can be a value or reference type. However, the focus of this article is on the <a href=\"https:\/\/code-maze.com\/csharp-valuetuple-vs-tuple\/\" target=\"_blank\" rel=\"noopener\">ValueTuple type<\/a>.\u00a0<\/p>\n<p>We can declare a tuple by enclosing a comma-separated list of elements in parentheses and assign values to it:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">(int id, string firstName, string lastName, float salary) EmployeeDetails = (1, \"John\", \"Doe\", 116000);<\/code><\/p>\n<p>Here, <code>EmployeeDetails<\/code> is a <code>ValueTuple<\/code> of four elements <code>id<\/code>, <code>firstName<\/code>, <code>lastName<\/code>, and <code>salary<\/code>.<\/p>\n<h2>Tuple Aliases<\/h2>\n<p>Aliases make it easier to associate an identifier with a namespace, type, or member. We are not introducing a new type when creating an alias. Instead, we are creating a synonym for an existing type.\u00a0<\/p>\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/csharp\/whats-new\/csharp-12\" target=\"_blank\" rel=\"nofollow noopener\">C# 12<\/a> introduced a new feature that allows us to create aliases for tuple types with the help of <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/csharp\/language-reference\/keywords\/using-directive#using-alias\" target=\"_blank\" rel=\"nofollow noopener\">using directive<\/a>.<\/p>\n<p>Before we dive into this new feature, we need to ensure that we are using the latest <a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\" target=\"_blank\" rel=\"nofollow noopener\">.Net 8 SDK<\/a> in our project.<\/p>\n<p>Now let&#8217;s see how we can create an alias for a tuple!<\/p>\n<p>We declare an alias <code>EmployeeFinanceDetails<\/code>\u00a0for a tuple with <em>four<\/em> elements (<em>int<\/em>, <em>string<\/em>, <em>string<\/em>, <em>double)<\/em> with the help of a <code>using<\/code> directive:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">using EmployeeFinanceDetails = (int id, string name, string familyName, double salary);<\/code><\/p>\n<p>The scope of the <code>EmployeeFinanceDetails<\/code> will be the current file.<\/p>\n<p>Now, let&#8217;s use a <code>global using<\/code> directive to create an alias at the assembly level:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">global using EmployeeDetails = (int id, string firstName, string lastName, float salary);<\/code><\/p>\n<p>We declare <code>EmployeeDetails<\/code> as an alias for a tuple type with <em>four<\/em> elements (<em>int, string, string<\/em>, and <em>float<\/em>).<\/p>\n<p>After declaring tuple aliases, we can use them as any other type: as a return type, a method parameter type, or a variable type.<\/p>\n<p>Let&#8217;s demonstrate this!<\/p>\n<p>We will create instances of our declared tuple aliases and assign values to them:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">EmployeeDetails employee = (1, \"John\",\"Doe\", 116000.25f);\r\nEmployeeFinanceDetails financeDetails = (1, \"John\", \"Doe\", 116000.25);<\/pre>\n<p>Here, <code>employee<\/code> and <code>financeDetails<\/code> are <em>instances<\/em> from the tuple aliases <code>EmployeeDetails<\/code> and <code>EmployeFinanceDetails<\/code> respectively.<\/p>\n<p>We can access their elements using the instance name:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">var employeeFullName = $\"Employee Full Name: {employee.firstName} {employee.lastName}\";<\/code><\/p>\n<p><code>firstName<\/code> and <code>lastName<\/code> are the elements from the tuple instance <code>employee<\/code>.<\/p>\n<h3>Precedence Rule for Local and Global Tuple Aliases<\/h3>\n<p>When working with aliases, it&#8217;s crucial to remember if a local alias shares the same name as a global alias and is used in the same scope, <strong>the local alias will take precedence over the global alias<\/strong>.\u00a0<\/p>\n<p>In short, within the scope of the local alias, only the local alias is considered even if it shares the same name as a global alias.<\/p>\n<p>The same precedence rule can be applied when concrete types and tuple aliases share the same name.<\/p>\n<p>Consider a scenario where we have a concrete type (class) that shares the same name as a tuple alias. To demonstrate this, let&#8217;s create two classes <code>EmployeeFinanceDetails<\/code> and\u00a0 <code>EmployeeDetails<\/code> that share the same name as our local and global tuple aliases respectively, and instantiate them:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">using System;\r\nusing EmployeeFinanceDetails = (int id, string name, string familyName, double salary);\r\n\r\npublic class EmployeeFinanceDetails\r\n{\r\n}\r\n\r\npublic class EmployeeDetails\r\n{\r\n}\r\n\r\npublic class TupleAlias\r\n{\r\n    public void PrintTupleValues()\r\n    {\r\n        \/\/GLOBAL TUPLE ALIAS\r\n        EmployeeDetails employee = (1, \"John\", \"Doe\", 116000.25f);\r\n        \r\n        \/\/LOCAL TUPLE ALIAS\r\n        EmployeeFinanceDetails financeDetails = (1, \"John\", \"Doe\", 116000.25);        \r\n    }\r\n}<\/pre>\n<p>We&#8217;ll encounter compile-time errors while creating instances for both <code class=\"\">EmployeeFinanceDetails<\/code> and <code class=\"\">EmployeeDetails<\/code>. But, the errors will be different. Creating an instance of <code>EmployeeDetails<\/code> will result in an <em>implicit type conversion <\/em>error<em>. <\/em>On the other hand, creating an instance of <code>EmployeeFinanceDetails<\/code> will lead to a <em>name conflict <\/em>error.<\/p>\n<p>The underlying cause for the distinct errors lies in the precedence of local and global aliases. <span class=\"animating\">In the scenario of a local class and a global tuple alias <code>EmployeeDetails<\/code> sharing the same name,<\/span><span class=\"animating\"> the local class takes precedence.<\/span><span class=\"animating\"> This explains why a <em>type conversion error<\/em> arises instead of a <em>name conflict error<\/em> which we encountered while creating an instance for our local tuple alias <code>EmployeeFinanceDetails<\/code><\/span><span class=\"animating\">.<\/span><\/p>\n<h2>Tuple Assignment<\/h2>\n<p><strong>Tuples can be assigned to each other as long as they match in arity and member types <\/strong>(exact or implicitly convertible). <strong>Only the arity and element type matter in tuples, not the field names themselves.<\/strong><\/p>\n<p>Let&#8217;s use our tuple instances to understand these conditions:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">financeDetails = employee;<\/code><\/p>\n<p>We are assigning values from the tuple instance <code>employee<\/code> to <code>financeDetails<\/code>. This tuple assignment works because <code>float<\/code> is implicitly convertible to <code>double<\/code> making these instances match in both arity and type.<\/p>\n<p>However, we will encounter a <strong>compile-time implicit conversion error<\/strong> if the assignment is reversed i.e. <code>financeDetails<\/code> to <code>employee<\/code>:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">employee = financeDetails;<\/code><\/p>\n<p>This is due to the fourth element of <code>financeDetails<\/code> which is of type <code>double<\/code>. This type is neither the <strong>same<\/strong> nor <strong>implicitly convertible<\/strong> to <code>float<\/code>.\u00a0<\/p>\n<h2>Tuple Aliases and Deconstruction<\/h2>\n<p><strong>Tuple deconstruction lets us extract elements and assign them to individual variables. <\/strong>We can use the assignment operator\u00a0<code>=<\/code> to deconstruct a tuple instance into separate variables.<\/p>\n<p>We can explicitly declare the type of each variable inside the parenthesis:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">(int id, string fName, string lName, float sal) = employee;<\/code><\/p>\n<p>Or, we can use a\u00a0<code>var<\/code> keyword outside the parentheses to declare implicitly typed variables:\u00a0<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">var (id, fName, lName, sal) = employee;<\/code><\/p>\n<p>Here, the compiler will infer the type of each element.<\/p>\n<p>We can use the variable directly instead of tuple fields:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">string employeeFullName = fName + \" \" + lName\";<\/code><\/p>\n<h2>Tuples Aliases vs. Classes<\/h2>\n<p>The lightweight and easy-to-write nature of tuples may tempt us to overuse them. We may even consider replacing classes with them to write simple and maintainable code.\u00a0But there are some downsides to using tuples extensively that we must consider.\u00a0<\/p>\n<p data-sourcepos=\"7:1-7:186\"><strong>Tuples do not store element names at runtime, so we cannot access them directly using reflection.<\/strong> Additionally, there are separate tuple types for each length of the tuple up to 7. Tuples with more than 7 elements require additional steps to access the remaining elements. Due to this, it is quite impractical to use tuples with a large number of elements.<\/p>\n<p data-sourcepos=\"7:1-7:186\">In contrast to <code>ValueTuple<\/code>, classes do persist their element names and we can access their element names via reflection at runtime. Classes also offer more flexibility than tuples.<\/p>\n<p><strong>To decide whether we need a class or a tuple, we can ask ourselves:<\/strong><\/p>\n<ul>\n<li>Are we using a design pattern where having a class is significant to the design of our system<\/li>\n<li>Do we need a type that describes the behavior that it provides<\/li>\n<li>Do we need to access the names of the elements at runtime<\/li>\n<li>Do we need the flexibility to add or remove elements in the future<\/li>\n<\/ul>\n<p>If the answer is yes to any of these questions, then a class may be a better choice. Otherwise, a tuple may be a good option. In short, we should use tuples when design significance is not a factor and we need a lightweight data structure to move information around.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, we learned what tuple aliases are and how to use them. We also explored how to use tuple aliases to write shorter and more readable code, and discussed how to choose between classes and tuples for different situations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will take an in-depth look at tuple aliases: what they are, how to use them, and the different rules that apply to them.\u00a0 Now let&#8217;s dig in! What Are Tuples in C#? Tuples in C# are lightweight data structures that store related data elements. A tuple can be a value or [&hellip;]<\/p>\n","protected":false},"author":94,"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,2010,1005],"class_list":["post-101303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-csharp","tag-c","tag-tuple-aliases","tag-tuples","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>Tuple Aliases in C# - Code Maze<\/title>\n<meta name=\"description\" content=\"In this article, we will take an in-depth look at tuple aliases, their benefits, and the difference between classes and aliases.\" \/>\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-tuple-aliases\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tuple Aliases in C# - Code Maze\" \/>\n<meta property=\"og:description\" content=\"In this article, we will take an in-depth look at tuple aliases, their benefits, and the difference between classes and aliases.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/csharp-tuple-aliases\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-11T00:35:23+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=\"Aditi Saxena\" \/>\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=\"Aditi Saxena\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 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-tuple-aliases\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/\"},\"author\":{\"name\":\"Aditi Saxena\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/bfa0e90c66f85733fe19ff5cb848e865\"},\"headline\":\"Tuple Aliases in C#\",\"datePublished\":\"2023-12-11T00:35:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/\"},\"wordCount\":1054,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"keywords\":[\"C#\",\"Tuple Aliases\",\"Tuples\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/csharp-tuple-aliases\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/\",\"url\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/\",\"name\":\"Tuple Aliases in C# - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"datePublished\":\"2023-12-11T00:35:23+00:00\",\"description\":\"In this article, we will take an in-depth look at tuple aliases, their benefits, and the difference between classes and aliases.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/csharp-tuple-aliases\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/csharp-tuple-aliases\/#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-tuple-aliases\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tuple Aliases 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\/bfa0e90c66f85733fe19ff5cb848e865\",\"name\":\"Aditi Saxena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/02\/Aditi-S-400px.jpeg-150x150.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/02\/Aditi-S-400px.jpeg-150x150.png\",\"caption\":\"Aditi Saxena\"},\"description\":\"Aditi is a developer with over 9 years of experience building applications using the Microsoft .NET ecosystem. She loves working on both the front-end and back-end of web applications. From designing user interfaces to building powerful APIs, she employs her experience with C#, .NET, ASP.NET Core, and Azure to create engaging experiences.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/aditi-saxena-4a823550\/\"],\"url\":\"https:\/\/code-maze.com\/author\/aditisaxena\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tuple Aliases in C# - Code Maze","description":"In this article, we will take an in-depth look at tuple aliases, their benefits, and the difference between classes and aliases.","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-tuple-aliases\/","og_locale":"en_US","og_type":"article","og_title":"Tuple Aliases in C# - Code Maze","og_description":"In this article, we will take an in-depth look at tuple aliases, their benefits, and the difference between classes and aliases.","og_url":"https:\/\/code-maze.com\/csharp-tuple-aliases\/","og_site_name":"Code Maze","article_published_time":"2023-12-11T00:35:23+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":"Aditi Saxena","twitter_card":"summary_large_image","twitter_creator":"@CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Aditi Saxena","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/"},"author":{"name":"Aditi Saxena","@id":"https:\/\/code-maze.com\/#\/schema\/person\/bfa0e90c66f85733fe19ff5cb848e865"},"headline":"Tuple Aliases in C#","datePublished":"2023-12-11T00:35:23+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/"},"wordCount":1054,"commentCount":0,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","keywords":["C#","Tuple Aliases","Tuples"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/csharp-tuple-aliases\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/","url":"https:\/\/code-maze.com\/csharp-tuple-aliases\/","name":"Tuple Aliases in C# - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","datePublished":"2023-12-11T00:35:23+00:00","description":"In this article, we will take an in-depth look at tuple aliases, their benefits, and the difference between classes and aliases.","breadcrumb":{"@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/csharp-tuple-aliases\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/csharp-tuple-aliases\/#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-tuple-aliases\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"Tuple Aliases 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\/bfa0e90c66f85733fe19ff5cb848e865","name":"Aditi Saxena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/02\/Aditi-S-400px.jpeg-150x150.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2024\/02\/Aditi-S-400px.jpeg-150x150.png","caption":"Aditi Saxena"},"description":"Aditi is a developer with over 9 years of experience building applications using the Microsoft .NET ecosystem. She loves working on both the front-end and back-end of web applications. From designing user interfaces to building powerful APIs, she employs her experience with C#, .NET, ASP.NET Core, and Azure to create engaging experiences.","sameAs":["https:\/\/www.linkedin.com\/in\/aditi-saxena-4a823550\/"],"url":"https:\/\/code-maze.com\/author\/aditisaxena\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/101303","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\/94"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=101303"}],"version-history":[{"count":2,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/101303\/revisions"}],"predecessor-version":[{"id":101305,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/101303\/revisions\/101305"}],"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=101303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=101303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=101303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}