{"id":2514,"date":"2017-02-02T13:42:17","date_gmt":"2017-02-02T13:42:16","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2514"},"modified":"2025-06-13T19:29:27","modified_gmt":"2025-06-14T02:29:27","slug":"net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/","title":{"rendered":".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase"},"content":{"rendered":"<div id=\"preamble\">\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>The addition of the <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/data\/data.html\">sub-document API<\/a> to Couchbase 4.5 has paved the way for efficient data structure support in <a href=\"https:\/\/www.couchbase.com\/developers\/?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">Couchbase<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>In this blog post, I\u2019m going to show a demo of three types of data structures you can use with the Couchbase .NET SDK:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>List &#8211; a list of objects, basically a List backed by Couchbase<\/li>\n<li>Queue &#8211; a queue of objects, basically a Queue backed by Couchbase<\/li>\n<li>Dictionary &#8211; a dictionary of objects, basically a Dictionary&lt;K,T&gt; backed by Couchbase<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>I\u2019ll also discuss a little bit how this works behind the scenes.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>You can play along at home if you like. The source code for this blog is <a href=\"https:\/\/github.com\/couchbaselabs\/blog-source-code\/tree\/master\/Groves\/050DataStructuresDotNet\/src\">available on GitHub<\/a>, and <a href=\"https:\/\/www.couchbase.com\/downloads\/\">Couchbase Server is free to download<\/a> (developer previews of version 5 are currently available monthly).<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"truelist\">List<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>A List is a .NET data structure that is held in memory. With the data structures provided by the Couchbase .NET SDK, you can store it in a Couchbase document.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>To create a Couchbase-backed List:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-C#\">var list = new CouchbaseList(bucket, \"myList\");<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>The string &#8220;myList&#8221; corresponds to the key for the document that will contain the list. When using <code>CouchbaseList<\/code>, a single document with that key will be created (if one doesn\u2019t exist already). If a document by that key already exists, <code>CouchbaseList<\/code> will use it.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>You can now add\/remove items from the list and that will all be persisted to the document. You can also perform other operations like getting a count of the items in the list.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-C#\">\/\/ add 10 objects to the list\r\nfor(var i = 0; i &lt; 10; i++)\r\n    list.Add(new { num = i, foo = \"bar\" + Guid.NewGuid()});\r\n\r\n\/\/ remove an item from the list by index\r\nlist.RemoveAt(5);\r\n\r\n\/\/ show an item from the list by index\r\nvar item = list[5];\r\nConsole.WriteLine(\"5th item in the list: \" + item.foo + \" \/ \" + item.num);<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>The above code would result in a document with a key &#8220;myList&#8221; that looks like below. Notice that the item with num of 5 is not listed, because it was removed.<\/p>\n<p>There\u2019s something subtle in the above example that needs to be pointed out. Notice that I used <code>var item = list[5];<\/code> and then <code>item.foo<\/code> and <code>item.num<\/code> in the <code>WriteLine<\/code>. If I used <code>list[5].foo<\/code> and <code>list[5].num<\/code> directly, that would result in two different subdocument calls to Couchbase. Not only is this less than optimal efficiency, but it\u2019s possible for the values to change between the two calls.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-JavaScript\">[\r\n  {\r\n    \"num\": 0,\r\n    \"foo\": \"bara1fd74ee-a790-4a0f-843c-abe449cb8b1d\"\r\n  },\r\n  {\r\n    \"num\": 1,\r\n    \"foo\": \"bardc1d8f9a-4e93-46f9-b8ae-ec036743869e\"\r\n  },\r\n  {\r\n    \"num\": 2,\r\n    \"foo\": \"bar9a60abe9-1e04-4fba-bd1f-f1ec39d69f56\"\r\n  },\r\n  {\r\n    \"num\": 3,\r\n    \"foo\": \"bar9566605b-7abf-4a0c-aa9d-63b98ce86274\"\r\n  },\r\n  {\r\n    \"num\": 4,\r\n    \"foo\": \"bar6261323f-de50-42a7-a8a7-6fcafb356deb\"\r\n  },\r\n  {\r\n    \"num\": 6,\r\n    \"foo\": \"bar13832bcb-2aa0-491a-a01f-1d496f999ffc\"\r\n  },\r\n\r\n  \/\/ ... etc ...\r\n]<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"truequeue\">Queue<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Very similar to List, you can create a Couchbase-backed queue:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-C#\">var queue = new CouchbaseQueue(bucket, \"myQueue\");<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>A queue is stored just like a list. The difference is that the ordering is significant, and this is reflected by the operations you perform on a queue: Enqueue and Dequeue.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-C#\">for(var i = 0; i &lt; 3; i++)\r\n    queue.Enqueue(new { num = i, foo = \"baz\" + Guid.NewGuid()});\r\n\r\n\/\/ dequeue\r\nvar item = queue.Dequeue();\r\nConsole.WriteLine(\"item num \" + item.num + \" was dequeued. There are now \" + queue.Count + \" items left in the queue.\");<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>The above code would result in a document with a key &#8220;myQueue&#8221; (see JSON below). Notice there is no object in the array with num &#8220;0&#8221; because it was dequeued.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-JavaScript\">[\r\n  {\r\n    \"num\": 1,\r\n    \"foo\": \"baz64bb62b6-bf23-4e52-b584-d2fa02accce6\"\r\n  },\r\n  {\r\n    \"num\": 2,\r\n    \"foo\": \"baz0a160bd9-aa7b-4c45-9e19-d1a3d982a554\"\r\n  }\r\n]<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"truedictionary\">Dictionary<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Hopefully you\u2019re seeing a pattern now. To create a dictionary:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-C#\">var dict = new CouchbaseDictionary&lt;string,dynamic&gt;(bucket, \"myDict\");<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Again, a document will be created with the given key. The operations that can be performed include Add, Remove, and the indexer <code>[]<\/code> operation.<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-C#\">for(var i = 0; i &lt; 5; i++)\r\n    dict.Add(\"key\" + Guid.NewGuid(), new { num = i, foo = \"qux\" + Guid.NewGuid()} );\r\n\r\n\/\/ print out keys in the dictionary\r\nConsole.WriteLine(\"There are \" + dict.Keys.Count + \" keys in the dictionary.\");\r\nforeach(var key in dict.Keys)\r\n    Console.WriteLine(\"key: \" + key + \", value.num: \" + dict[key].num);<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>A dictionary document looks like:<\/p>\n<\/div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlightjs highlight\"><code class=\"language-JavaScript\">{\r\n  \"key5aa2520d-123c-4fca-b444-b0cb8846d46e\": {\r\n    \"num\": 0,\r\n    \"foo\": \"qux93b197dc-f175-4246-a38d-7b080eb9bea0\"\r\n  },\r\n  \"key55dee298-14c6-4da7-97a8-66c69d7e8a70\": {\r\n    \"num\": 1,\r\n    \"foo\": \"quxa593ee4c-682c-402d-887b-3f09f029e9b6\"\r\n  },\r\n  \"key3386afcf-7b70-4e4d-b9ae-6defbca33fe7\": {\r\n    \"num\": 2,\r\n    \"foo\": \"qux1259ae94-1008-4e1f-86a1-bfbd0873b09b\"\r\n  },\r\n  \"key2bc8c451-f125-4282-9fb4-7ea15f4b3168\": {\r\n    \"num\": 3,\r\n    \"foo\": \"qux1b6fb62b-9918-46dc-9a2f-610a55d017ef\"\r\n  },\r\n  \"key3f7041f3-abd3-49c7-a373-454cbd2ac0fc\": {\r\n    \"num\": 4,\r\n    \"foo\": \"qux0a87655f-197d-4fb2-8a54-b1de6e288de4\"\r\n  }\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>A note about C# dynamic: I used <code>dynamic<\/code> to keep the code samples short and simple. In your application, you are probably better off using a real defined C# type. It all gets serialized to JSON in Couchbase, of course.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"truebehind-the-scenes\">Behind the scenes<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Before the subdocument API was released in Couchbase Server 4.5, these data structures were <em>possible<\/em>, of course. The catch was that you would be loading up the entire document, putting it in a list, making changes to the list, and then saving the entire document. If you have large data structures, but are only reading or making changes to a single item, this would often result in wasted time and wasted bandwidth and possibly increased contention.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The subdocument-API (which you can use directly; I covered it in the <a href=\"https:\/\/www.couchbase.com\/blog\/sub-document-api-in-couchbase-server-4.5-with-the-.net-sdk-revisted\/\">Sub-document API in Couchbase Server 4.5 with the .NET SDK (revisited)<\/a> blog post) is used behind the scenes in <code>CouchbaseList<\/code>, <code>CouchbaseQueue<\/code>, and <code>CouchbaseDictionary<\/code>. So when you add an item to a <code>CouchbaseList<\/code>, for instance, only that item is being sent over the wire, not the entire list.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Some operations will still need to get the entire document. For instance, iterating through a collection using a <code>foreach<\/code> loop will retrieve the full document. Removing an item from a list will result in the full document being scanned. But if sub-document operations come along in the future to support those actions, the SDK implementations will be updated accordinging.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"truesummary\">Summary<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>These data structures are another tool to help you manage your data. Since they use the sub-document API, they are generally more performant than a whole-document approach. For more detail, check out the <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/sdk\/dotnet\/datastructures.html?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">Data Structures documentation<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Have questions? Feedback? Need help? <a href=\"https:\/\/www.couchbase.com\/forums\/?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">Please visit our forums<\/a>, ping me on <a href=\"https:\/\/twitter.com\/mgroves\">Twitter @mgroves<\/a>, or leave a comment.<\/p>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The addition of the sub-document API to Couchbase 4.5 has paved the way for efficient data structure support in Couchbase. In this blog post, I\u2019m going to show a demo of three types of data structures you can use with [&hellip;]<\/p>\n","protected":false},"author":71,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1811,1816,1819],"tags":[1447,1800],"ppma_author":[8937],"class_list":["post-2514","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-couchbase-server","category-data-modeling","tag-data-modeling","tag-data-structures"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.0 (Yoast SEO v26.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>.NET Core List, Queue, and Dictionary Data Structures backed by Couchbase - The Couchbase Blog<\/title>\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\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase\" \/>\n<meta property=\"og:description\" content=\"The addition of the sub-document API to Couchbase 4.5 has paved the way for efficient data structure support in Couchbase. In this blog post, I\u2019m going to show a demo of three types of data structures you can use with [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-02T13:42:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T02:29:27+00:00\" \/>\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\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/\"},\"author\":{\"name\":\"Matthew Groves\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58\"},\"headline\":\".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase\",\"datePublished\":\"2017-02-02T13:42:16+00:00\",\"dateModified\":\"2025-06-14T02:29:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/\"},\"wordCount\":739,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"Data Modeling\",\"Data structures\"],\"articleSection\":[\".NET\",\"Couchbase Server\",\"Data Modeling\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/\",\"name\":\".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-02-02T13:42:16+00:00\",\"dateModified\":\"2025-06-14T02:29:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase\"}]},{\"@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":".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase - The Couchbase Blog","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\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/","og_locale":"en_US","og_type":"article","og_title":".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase","og_description":"The addition of the sub-document API to Couchbase 4.5 has paved the way for efficient data structure support in Couchbase. In this blog post, I\u2019m going to show a demo of three types of data structures you can use with [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-02-02T13:42:16+00:00","article_modified_time":"2025-06-14T02:29:27+00:00","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\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/"},"author":{"name":"Matthew Groves","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3929663e372020321b0152dc4fa65a58"},"headline":".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase","datePublished":"2017-02-02T13:42:16+00:00","dateModified":"2025-06-14T02:29:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/"},"wordCount":739,"commentCount":2,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["Data Modeling","Data structures"],"articleSection":[".NET","Couchbase Server","Data Modeling"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/","url":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/","name":".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-02-02T13:42:16+00:00","dateModified":"2025-06-14T02:29:27+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/net-core-list-queue-and-dictionary-data-structures-backed-by-couchbase\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":".NET Core List, Queue, and Dictionary Data Structures backed by Couchbase"}]},{"@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\/2514","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=2514"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2514\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=2514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2514"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}