{"id":3175,"date":"2017-04-06T06:00:32","date_gmt":"2017-04-06T13:00:32","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=3175"},"modified":"2025-06-13T20:57:09","modified_gmt":"2025-06-14T03:57:09","slug":"csharp-tuples-new-csharp-7-feature","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/","title":{"rendered":"C# Tuples: New C# 7 language feature"},"content":{"rendered":"<div class=\"paragraph\">\n<div class=\"paragraph\">\n<p>C# tuples are a new feature of C# 7. I\u2019m going to show you the basics of how C# tuples work. I\u2019m also going to mix in a little Couchbase to show tuples in action. However, if you don\u2019t want to <a href=\"https:\/\/couchbase.com\/downloads\/\">install Couchbase<\/a> just to play around with tuples, don\u2019t worry, you will still be able to follow along.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The <a href=\"https:\/\/github.com\/couchbaselabs\/blog-source-code\/tree\/master\/Groves\/063TuplesCSharp7\/tuples-example\">source code that I use for this blog post is available on GitHub<\/a> for you to try out if you\u2019d like.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><em>Note: If you\u2019ve been using C# for a while, you might remember the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/system.tuple(v=vs.110).aspx\">Tuple Class that was introduced in .NET 4<\/a>. That class still exists, but it is not the same thing as the new tuple feature of C#.<\/em><\/p>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_what_are_c_tuples\">What are C# tuples?<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>A &#8220;tuple&#8221; is a name for a mathematical concept that is just a list of elements. In the LISP family of languages, coding is built almost entirely around the idea that everything is a list. C# once again borrows the kernel of an idea from the functional programming world and integrates it into a non-functional language. So, we get C# tuples (check out the <a href=\"https:\/\/github.com\/dotnet\/roslyn\/issues\/347\">original C# tuple proposal by Mads Torgersen<\/a> for more details and background).<\/p>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_remember_anonymous_types\">Remember anonymous types?<\/h3>\n<div class=\"paragraph\">\n<p>But, to make it simple, let\u2019s consider something you may already be familiar with in C#, an anonymous type. To review, you can instantiate a new object without specifying a type:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">var myObject = new { Foo = \"bar\", Baz = 123 };<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Behind the scenes, there actually <em>is<\/em> a type that inherits from the base <code>Object<\/code> type, but generally speaking, we only deal with the object, not its type.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Additionally, I can\u2019t return an anonymous type from a method, or pass an anonymous type as a parameter without losing the type information in the process.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">private object GetAnonymousObject()\r\n{\r\n    return new {Foo = \"bar\", Baz = 123};\r\n}\r\n\r\nprivate void AnotherMethod()\r\n{\r\n    var obj = GetAnonymousObject();\r\n    Console.WriteLine(obj.Foo); \/\/ compiler error :(\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>They are useful, certainly, but I generally refer to these as anonymous <em>objects<\/em> as I use them, for these reasons.<\/p>\n<\/div>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_what_s_this_got_to_do_with_c_tuples\">What\u2019s this got to do with C# tuples?<\/h3>\n<div class=\"paragraph\">\n<p>I think of C# tuples as a way to make C# return anonymous types, but with richer information. They are a way to create a &#8220;class&#8221; on the fly without actually defining a class. The syntax for tuples is to simply put parentheses around a comma separated list of types and names. A tuple literal is just a comma separated list of literals also surrounded by parentheses. For instance:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">(string FirstName, string LastName) myTuple = (\"Matt\", \"Groves\");\r\n\r\nConsole.WriteLine(myTuple.FirstName); \/\/ no compiler error :)\r\nConsole.WriteLine(myTuple.LastName);  \/\/ no compiler error :)<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p><em>Note: Right now I\u2019m preferring PascalCase for tuple properties. I don\u2019t know if that\u2019s the official guideline or not, but it &#8220;feels&#8221; right to me.<\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_c_tuples_in_action\">C# tuples in action<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>I put tuples to work in a simple console app that interacts with Couchbase.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>I created a <code>BucketHelper<\/code> class that is a very simple facade over the normal Couchbase <code>IBucket<\/code>. This class has two methods: one to get a document by key and return a tuple, and one to insert a tuple as a document.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">public class BucketHelper\r\n{\r\n    private readonly IBucket _bucket;\r\n\r\n    public BucketHelper(IBucket bucket)\r\n    {\r\n        _bucket = bucket;\r\n    }\r\n\r\n    public (string Key, T obj) GetTuple&lt;T&gt;(string key)\r\n    {\r\n        var doc = _bucket.Get&lt;T&gt;(key);\r\n        return (doc.Id, doc.Value);\r\n    }\r\n\r\n    public void InsertTuple&lt;T&gt;((string Key, T obj) tuple)\r\n    {\r\n        _bucket.Insert(new Document&lt;T&gt;\r\n        {\r\n            Id = tuple.Key,\r\n            Content = tuple.obj\r\n        });\r\n    }\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>To instantiate this helper, you just need to pass an <code>IBucket<\/code> into the constructor.<\/p>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_tuple_as_a_return_type\">Tuple as a return type<\/h3>\n<div class=\"paragraph\">\n<p>You can then use the <code>GetTuple<\/code> method to get a document out of Couchbase as a tuple.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">var bucketHelper = new BucketHelper(bucket);\r\n\r\n(string key, Film film) fightClub = bucketHelper.GetTuple&lt;Film&gt;(\"film-001\");<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>The tuple will consist of a string (the document key) and an object of whatever type you specify. The document content is JSON and will be serialized to a C# object by the .NET SDK.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Also, notice that the name of the tuple properties don\u2019t have to match. I used <code>obj<\/code> in <code>BucketHelper<\/code> but I used <code>film<\/code> when I called <code>GetTuple&lt;Film&gt;<\/code>. The types do have to match, of course.<\/p>\n<\/div>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_tuple_as_a_parameter_type\">Tuple as a parameter type<\/h3>\n<div class=\"paragraph\">\n<p>I can also go the other way and pass a tuple as a parameter to <code>InsertTuple<\/code>.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight decode:true\"><code class=\"language-C#\">string key = Guid.NewGuid().ToString();\r\nFilm randomFilm = GenerateRandomFilm();\r\nbucketHelper.InsertTuple((key, randomFilm));<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>The <code>GenerateRandomFilm<\/code> method returns a <code>Film<\/code> object with some random-ish values (check out the <a href=\"https:\/\/github.com\/couchbaselabs\/blog-source-code\/tree\/master\/Groves\/063TuplesCSharp7\/tuples-example\">GitHub source<\/a> for details). A tuple of <code>(string, Film)<\/code> is passed to <code>InsertTuple<\/code>. The Couchbase .NET SDK takes it from there and inserts a document with the appropriate key\/value.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Running the console app, you should get an output that looks something like this:<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><span class=\"image\"><img decoding=\"async\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/06301-csharp-tuples-console-output.png\" alt=\"C# tuples sample console output\" \/><\/span><\/p>\n<\/div>\n<div class=\"paragraph\">\n<p><em>Note that the Couchbase .NET SDK at this time doesn\u2019t have any direct tuple support, and it may not ever need it. This code is simply to help demonstrate C# tuples. I would not recommend using the BucketHelper as-is in production.<\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_tuh_ple_or_too_ple\">TUH-ple or TOO-ple?<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>I seem to remember my professor(s) pronouncing it as &#8220;TOO-ple&#8221;, so that\u2019s what I use. Like the hard-G \/ soft-G debate of &#8220;GIF&#8221;, I\u2019m sure there are those who think this debate is of the utmost importance and are convinced their pronunciation is the one true way. But, <a href=\"https:\/\/english.stackexchange.com\/questions\/12980\/how-to-pronounce-tuple\">both are acceptable<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>If you have questions about tuples, I\u2019d be happy to help. You can also contact me at <a href=\"https:\/\/twitter.com\/mgroves\">Twitter @mgroves<\/a> or email me <a href=\"mailto:matthew.groves@couchbase.com\">matthew.groves@couchbase.com<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>If you have questions about the Couchbase .NET SDK that I used in this post, please ask away in the <a href=\"https:\/\/www.couchbase.com\/forums\/c\/net-sdk\/6\/\">Couchbase .NET Forums<\/a>. Also check out the <a href=\"https:\/\/www.couchbase.com\/developers\/\">Couchbase Developer Portal<\/a> for more information on the .NET SDK and Couchbase in general.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>C# tuples are a new feature of C# 7. I\u2019m going to show you the basics of how C# tuples work. I\u2019m also going to mix in a little Couchbase to show tuples in action. However, if you don\u2019t want [&hellip;]<\/p>\n","protected":false},"author":71,"featured_media":3176,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1811,10127,1816],"tags":[],"ppma_author":[8937],"class_list":["post-3175","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-c-sharp","category-couchbase-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>C# Tuples Language Feature | Basics of How C# Tuples Work<\/title>\n<meta name=\"description\" content=\"C# tuples are a new feature of C# 7. Learn the basics of how C# tuples work from this post, including a mix of a little Couchbase to show tuples in action.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C# Tuples: New C# 7 language feature\" \/>\n<meta property=\"og:description\" content=\"C# tuples are a new feature of C# 7. Learn the basics of how C# tuples work from this post, including a mix of a little Couchbase to show tuples in action.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-04-06T13:00:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:57:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"818\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Matthew Groves\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mgroves\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matthew Groves\" \/>\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\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/\"},\"author\":{\"name\":\"Matthew Groves\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\"},\"headline\":\"C# Tuples: New C# 7 language feature\",\"datePublished\":\"2017-04-06T13:00:32+00:00\",\"dateModified\":\"2025-06-14T03:57:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/\"},\"wordCount\":820,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg\",\"articleSection\":[\".NET\",\"C#\",\"Couchbase Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/\",\"name\":\"C# Tuples Language Feature | Basics of How C# Tuples Work\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg\",\"datePublished\":\"2017-04-06T13:00:32+00:00\",\"dateModified\":\"2025-06-14T03:57:09+00:00\",\"description\":\"C# tuples are a new feature of C# 7. Learn the basics of how C# tuples work from this post, including a mix of a little Couchbase to show tuples in action.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg\",\"width\":1920,\"height\":818,\"caption\":\"Infinite Mirror\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C# Tuples: New C# 7 language feature\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\",\"name\":\"Matthew Groves\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g\",\"caption\":\"Matthew Groves\"},\"description\":\"Matthew D. Groves is a guy who loves to code. It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything. He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s. He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community. He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP.\",\"sameAs\":[\"https:\/\/crosscuttingconcerns.com\",\"https:\/\/x.com\/mgroves\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/matthew-groves\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"C# Tuples Language Feature | Basics of How C# Tuples Work","description":"C# tuples are a new feature of C# 7. Learn the basics of how C# tuples work from this post, including a mix of a little Couchbase to show tuples in action.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/","og_locale":"en_US","og_type":"article","og_title":"C# Tuples: New C# 7 language feature","og_description":"C# tuples are a new feature of C# 7. Learn the basics of how C# tuples work from this post, including a mix of a little Couchbase to show tuples in action.","og_url":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-04-06T13:00:32+00:00","article_modified_time":"2025-06-14T03:57:09+00:00","og_image":[{"width":1920,"height":818,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg","type":"image\/jpeg"}],"author":"Matthew Groves","twitter_card":"summary_large_image","twitter_creator":"@mgroves","twitter_misc":{"Written by":"Matthew Groves","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/"},"author":{"name":"Matthew Groves","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58"},"headline":"C# Tuples: New C# 7 language feature","datePublished":"2017-04-06T13:00:32+00:00","dateModified":"2025-06-14T03:57:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/"},"wordCount":820,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg","articleSection":[".NET","C#","Couchbase Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/","url":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/","name":"C# Tuples Language Feature | Basics of How C# Tuples Work","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg","datePublished":"2017-04-06T13:00:32+00:00","dateModified":"2025-06-14T03:57:09+00:00","description":"C# tuples are a new feature of C# 7. Learn the basics of how C# tuples work from this post, including a mix of a little Couchbase to show tuples in action.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/063-hero-infinite-mirror.jpg","width":1920,"height":818,"caption":"Infinite Mirror"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/csharp-tuples-new-csharp-7-feature\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"C# Tuples: New C# 7 language feature"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58","name":"Matthew Groves","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/ba51e6aacc53995c323a634e4502ef54","url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","caption":"Matthew Groves"},"description":"Matthew D. Groves is a guy who loves to code. It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything. He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s. He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community. He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP.","sameAs":["https:\/\/crosscuttingconcerns.com","https:\/\/x.com\/mgroves"],"url":"https:\/\/www.couchbase.com\/blog\/author\/matthew-groves\/"}]}},"authors":[{"term_id":8937,"user_id":71,"is_guest":0,"slug":"matthew-groves","display_name":"Matthew Groves","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/70feb1b28a099ad0112b8d21fe1e81e1a4524beed3e20b7f107d5370e85a07ab?s=96&d=mm&r=g","author_category":"","last_name":"Groves","first_name":"Matthew","job_title":"","user_url":"https:\/\/crosscuttingconcerns.com","description":"Matthew D. Groves is a guy who loves to code.  It doesn't matter if it's C#, jQuery, or PHP: he'll submit pull requests for anything.  He has been coding professionally ever since he wrote a QuickBASIC point-of-sale app for his parent's pizza shop back in the 90s.  He currently works as a Senior Product Marketing Manager for Couchbase. His free time is spent with his family, watching the Reds, and getting involved in the developer community.  He is the author of AOP in .NET, Pro Microservices in .NET, a Pluralsight author, and a Microsoft MVP."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/3175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=3175"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/3175\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/3176"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=3175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=3175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=3175"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=3175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}