{"id":32589,"date":"2021-03-23T18:00:00","date_gmt":"2021-03-23T17:00:00","guid":{"rendered":"https:\/\/blexin.com\/?p=32589"},"modified":"2021-04-12T16:48:24","modified_gmt":"2021-04-12T14:48:24","slug":"positional-records-c-9","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/","title":{"rendered":"Positional records in C# 9"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-32563\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record-1024x608.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In a <a href=\"https:\/\/blexin.com\/en\/blog-en\/a-look-to-the-future-c-9\/\" target=\"_blank\" rel=\"noreferrer noopener\">previous article<\/a>, I have talked about the probable innovations that would be introduced with the new version of the Microsoft language C# 9.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Among these, the one that seems to be the most interesting for many developers is the introduction of <em>Records<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A <em>Record<\/em> type provides us an easier way to create an immutable reference type in .NET. In fact, by default, the <em>Record<\/em>\u2019s instance property values cannot change after its initialization.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The data are passed by value and the equality between two <em>Records <\/em>is verified by comparing the value of their properties.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Therefore, <em>Records <\/em>can be used effectively when we need immutability, as we need to send or receive data, or when we need to compare the property values of objects of the same type.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before exploring the topic, let&#8217;s talk about another feature introduced with this version of the language and closely related to the <em>Records<\/em>: the <em>init <\/em>keyword, which should be associated with properties and indexers.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n public class Person \n{ \n        public string Name { get; init; } \n        public string Surname { get; init; } \n\n        public Person() \n        { \n        } \n\n        public Person(string name, string surname) \n\n        { \n                Name = name; \n                Surname = surname; \n        } \n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Thanks to this new functionality, as the name suggests, the&nbsp;<em>init&nbsp;only<\/em>&nbsp;properties can be set&nbsp;only&nbsp;when the object is initialized, but they cannot be changed later;&nbsp;in this way,&nbsp;it is possible to have an immutable model:&nbsp;&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar person = new Person\t\t\t\t        \/\/Object Initializer \n{ \n        Name = &quot;Francesco&quot;, \n        Surname = &quot;Vas&quot; \n}; \n\nvar otherPerson = new Person(&quot;Adolfo&quot;, &quot;Arnold&quot;);\t\/\/Constructor \n\nperson.Surname = &quot;de Vicariis&quot;; \t\t\t\/\/Compile error \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Please note: since there is a parameterized constructor in the class, the <em>Object Initializer <\/em>code fragment compiles only if the parameterless constructor is explicitly present.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s go back to <em>Records <\/em>and see how to define them using the default syntax. Those <em>Records <\/em>written in this way, i.e. with a list of parameters, are called <em>Positional Records<\/em>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic record Person(string Name, string Surname); \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s see what&#8217;s behind the scenes!&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Analyzing the&nbsp;<em>IL<\/em>&nbsp;code generated by this syntax, we see that the instruction is interpreted as a&nbsp;<em>Person&nbsp;<\/em>class that implements the&nbsp;<em>IEquatable<\/em><em>&lt;T&gt;<\/em>&nbsp;interface.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The class contains two private fields of the string type and a parameterized constructor with the two related arguments of the string type:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n.class public auto ansi beforefieldinit Person extends &#x5B;System.Runtime]System.Object \nimplements class &#x5B;System.Runtime]System.IEquatable`1&lt;class Person&gt; \n{ \n  \t     .field private initonly string &#039;&lt;Name&gt;k__BackingField&#039; \n  \t     .field private initonly string &#039;&lt;Surname&gt;k__BackingField&#039; \n         .method public hidebysig specialname rtspecialname instance void   \n         .ctor(string Name, string Surname) cil managed \n  \t     { \n                string Person::&#039;&lt;Name&gt;k__BackingField&#039; \n                string Person::&#039;&lt;Surname&gt;k__BackingField&#039; \n                instance void &#x5B;System.Runtime]System.Object::.ctor() \n        } \n} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We also see the public <em>getter<\/em> and <em>setter<\/em> methods of the properties, but if we pay attention, we note that the setter methods have the <em>IsExternalInit <\/em>attribute:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n.method public hidebysig specialname instance void modreq (&#x5B;System.Runtime]System.Runtime.CompilerServices.IsExternalInit) \n\n    set_Name(string &#039;value&#039;) cil managed \n\n{ \/\/...} \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This is because the keyword <em>init<\/em>, which we talked about at the beginning of the article, is used for each property of the Record declared with the default syntax:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic string Name { get; init; } \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">To&nbsp;let you&nbsp;understand better,&nbsp;I&nbsp;will show you a file produced with an&nbsp;<em>IL<\/em>&nbsp;code analysis software (<em>ILSpy<\/em>), which interprets our definition as follows:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class Person : IEquatable&lt;Person&gt; \n{ \n        private readonly string &lt;Name&gt;k__BackingField; \n\n        private readonly string &lt;Surname&gt;k__BackingField; \n\n        protected virtual Type EqualityContract \n        { \n                get { return typeof(Person); } \n        } \n\n        public string Name { get; init; } \n\n        public string Surname { get; init; } \n  \n        public Person(string Name, string Surname) \n        { \n                this.Name = Name; \n                this.Surname = Surname; \n                base..ctor(); \n        } \n\n        public override string ToString() \n        { \n                StringBuilder stringBuilder = new StringBuilder(); \n           \t    stringBuilder.Append(&quot;Person&quot;); \n                stringBuilder.Append(&quot; { &quot;); \n                if (PrintMembers(stringBuilder)) \n        { \n                stringBuilder.Append(&quot; &quot;); \n        } \n\n        stringBuilder.Append(&quot;}&quot;); \n\n        return stringBuilder.ToString(); \n        } \n\n         protected virtual bool PrintMembers(StringBuilder builder) \n        { \n                builder.Append(&quot;Name&quot;); \n                builder.Append(&quot; = &quot;); \n                builder.Append((object?)Name); \n                builder.Append(&quot;, &quot;); \n                builder.Append(&quot;Surname&quot;); \n                builder.Append(&quot; = &quot;); \n                builder.Append((object?)Surname); \n   \t            return true; \n        } \n\n        public static bool operator !=(Person? r1, Person? r2) \n        { \n                return !(r1 == r2); \n        } \n\n        public static bool operator ==(Person? r1, Person? r2) \n        { \n                 return (object)r1 == r2 || (r1?.Equals(r2) ?? false); \n        } \n\n        public override int GetHashCode() \n        { \n                return (EqualityComparer&lt;Type&gt;.Default.GetHashCode(EqualityContract) * -1521134295 + \n                EqualityComparer&lt;string&gt;.Default.GetHashCode(Name)) * -1521134295 +  \n                EqualityComparer&lt;string&gt;.Default.GetHashCode(Surname); \n         } \n\n         public override bool Equals(object? obj) \n        { \n                return Equals(obj as Person); \n        } \n\n        public virtual bool Equals(Person? other) \n        { \n                return (object)other != null &amp;&amp; EqualityContract == other!.EqualityContract  \n                &amp;&amp; EqualityComparer&lt;string&gt;.Default.Equals(Name, other!.Name)  \n                &amp;&amp; EqualityComparer&lt;string&gt;.Default.Equals(Surname, other!.Surname); \n        } \n\n        public virtual Person&lt;Clone&gt;$() \n        { \n                return new Person(this); \n        } \n\n        protected Person(Person original) \n        { \n                Name = original.Name; \n                Surname = original.Surname; \n        } \n\n        public void Deconstruct(out string Name, out string Surname) \n        { \n                Name = this.Name; \n                Surname = this.Surname; \n        } \n\n}     \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We can see that, with a single line of code, we will have:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><em>Init<\/em> only properties that guarantee us an immutable type instance without additional declarations.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>A constructor with all its properties as arguments, called <em>Primary Constructor<\/em>.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>A&nbsp;<em>PrintMembers()<\/em>&nbsp;method and an override of the&nbsp;<em>ToString()<\/em>&nbsp;method that provide us with a textual representation of the type and values of the object&#8217;s properties.&nbsp;<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Value-based equality checks with no need to override the <em>GetHashCode()<\/em> and <em>Equals()<\/em> methods.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>An implementation of the <em>Deconstruct() <\/em>method, which allows us to use object deconstruction to access individual properties as individual values.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s take some concrete examples. We initialize a <em>Record<\/em> type object using a constructor as if we were creating an instance of a class:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar person = new Person(&quot;Francesco&quot;, &quot;Vas&quot;); \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">It\u2019s not possible to use an&nbsp;<em>Object Initializer&nbsp;<\/em>by defining a&nbsp;<em>Record&nbsp;<\/em>with the default syntax. As we saw from the IL code, the class has only the parameterized constructor.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But&nbsp;instead,&nbsp;a&nbsp;parameterless&nbsp;constructor is missing, which is necessary for its operation:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar personWithInitializer = new Person { Name = &quot;Francesco&quot;, Surname = &quot;Vas&quot; }; \t\/\/Compile error \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">If we try to change the value of a property after the object is initialized, we get a compile error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As we said, it is not possible to change the value of an existing instance of a <em>record <\/em>type:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nperson.Name = &quot;Adolfo&quot;; \t\t\t\t\/\/Compile error\t\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We can create a copy of the <em>record<\/em> instance by changing all or some of its properties:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar otherPerson = person with { Surname = &quot;de Vicariis&quot; }; \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">In this way,&nbsp;we create a new&nbsp;<em>otherPerson&nbsp;Record&nbsp;<\/em>of type&nbsp;<em>Person&nbsp;<\/em>with the same values as the existing instance&nbsp;<em>person<\/em>,&nbsp;except for the values we supply after the&nbsp;with&nbsp;statement.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If we now try to use the override of the <em>ToString() <\/em>method that the definition of the <em>Record <\/em>provides, we can verify that the results are as expected:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nConsole.WriteLine(person.ToString());\t\/\/ Person { Name = Francesco, Surname = Vas } \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Or we can simply write:&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nConsole.WriteLine(otherPerson);\t\t\/\/ Person { Name = Francesco, Surname = de Vicariis } \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">As expected, we get the textual representation of the type, property values of the two <em>Records<\/em>, and the the original <em>record <\/em>instance has been cloned and modified.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s now try to compare two <em>records<\/em>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar person = new Person(&quot;Francesco&quot;, &quot;Vas&quot;); \n\nvar otherPerson = new Person(&quot;Francesco&quot;, &quot;Vas&quot;); \n\nConsole.WriteLine(person.Equals(otherPerson));\t\t\t                                        \/\/Returns True \nConsole.WriteLine(person == otherPerson);\t\t\t\t                                            \/\/Returns True \nConsole.WriteLine(person.GetHashCode() == otherPerson.GetHashCode());\t\/\/Returns True \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Unlike a <em>class, Records<\/em> follow structural equality rather than referential equality. Structural equality ensures that two records are considered equal if their type is equal and all properties\u2019 values are equal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s also briefly talk about the <em>deconstructor<\/em>, which is not a novelty introduced with C# 9, but is made available to us in a \u201cfree\u201d way by the definition of the <em>Positional Record<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As we have seen from the IL code, there is a <em>Deconstruct <\/em>method with as many parameters as the properties of the <em>Record <\/em>we have created. This allows us to access all properties individually:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar person = new Person (&quot;Francesco&quot;, &quot;Vas&quot;, 20); \nvar (name, surname, id) = person; \n\nConsole.WriteLine(name + &quot; &quot; + surname + &quot;, Id: &quot; + id);\t\t\/\/ Francesco Vas, Id: 20 \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Or we can use&nbsp;<em>discard&nbsp;<\/em>variables to ignore elements returned by a&nbsp;<em>Deconstruct&nbsp;<\/em>method:&nbsp;&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar (_, _, onlyId) = person; \n\nConsole.WriteLine(onlyId);\t\t\/\/ 20  \n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Each <em>discard<\/em> variable is defined by a variable named<em> &#8220;_&#8221;<\/em>, and a single deconstruction operation can include several <em>discard<\/em> variables.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Records<\/em> can be a valid alternative to classes when we have to send or receive data. The very purpose of a DTO is to transfer data from one part of the code to another, and immutability in many cases can be useful. We could use them to return data from a Web API or to represent events in our application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They can be used easily when we need to compare property values of objects of the same type. Furthermore, immutability can help us in simultaneous access to data: we do not need to synchronize access to data if the data is immutable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What do you think of all these features in a single line of code? I find it really practical!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There would still be so much to say. For example, it is also possible to write our own Record and customize it, or that the <em>Records <\/em>support inheritance from other <em>Records<\/em>\u2026 but we will talk about it maybe another time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">See you in the next article! Stay Tuned!<\/p>\n\n\n\n\n[et_pb_section global_module=\"26289\"][\/et_pb_section]\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s find out what&#8217;s behind a positional record in C# 9 <\/p>\n","protected":false},"author":196716244,"featured_media":32564,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","inline_featured_image":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[688637524],"tags":[688637384],"class_list":["post-32589","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-c-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Positional records in C# 9 - Blexin<\/title>\n<meta name=\"description\" content=\"Let&#039;s find out what&#039;s behind a positional record in C# 9\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Positional records in C# 9 - Blexin\" \/>\n<meta property=\"og:description\" content=\"Let&#039;s find out what&#039;s behind a positional record in C# 9\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-23T17:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-12T14:48:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1105\" \/>\n\t<meta property=\"og:image:height\" content=\"656\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Francesco Vastarella\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Francesco Vastarella\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/\"},\"author\":{\"name\":\"Francesco Vastarella\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/388dae0ca9df603c88b5e41e29cf2d4d\"},\"headline\":\"Positional records in C# 9\",\"datePublished\":\"2021-03-23T17:00:00+00:00\",\"dateModified\":\"2021-04-12T14:48:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/\"},\"wordCount\":1084,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1\",\"keywords\":[\"C#\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/\",\"name\":\"Positional records in C# 9 - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1\",\"datePublished\":\"2021-03-23T17:00:00+00:00\",\"dateModified\":\"2021-04-12T14:48:24+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/388dae0ca9df603c88b5e41e29cf2d4d\"},\"description\":\"Let's find out what's behind a positional record in C# 9\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1\",\"width\":1105,\"height\":656},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/positional-records-c-9\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Positional records in C# 9\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/388dae0ca9df603c88b5e41e29cf2d4d\",\"name\":\"Francesco Vastarella\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g\",\"caption\":\"Francesco Vastarella\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/francesco-vastarellablexin-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Positional records in C# 9 - Blexin","description":"Let's find out what's behind a positional record in C# 9","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:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/","og_locale":"en_US","og_type":"article","og_title":"Positional records in C# 9 - Blexin","og_description":"Let's find out what's behind a positional record in C# 9","og_url":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/","og_site_name":"Blexin","article_published_time":"2021-03-23T17:00:00+00:00","article_modified_time":"2021-04-12T14:48:24+00:00","og_image":[{"width":1105,"height":656,"url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1","type":"image\/png"}],"author":"Francesco Vastarella","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Francesco Vastarella","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/"},"author":{"name":"Francesco Vastarella","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d"},"headline":"Positional records in C# 9","datePublished":"2021-03-23T17:00:00+00:00","dateModified":"2021-04-12T14:48:24+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/"},"wordCount":1084,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1","keywords":["C#"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/","url":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/","name":"Positional records in C# 9 - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1","datePublished":"2021-03-23T17:00:00+00:00","dateModified":"2021-04-12T14:48:24+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d"},"description":"Let's find out what's behind a positional record in C# 9","breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1","width":1105,"height":656},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/positional-records-c-9\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"Positional records in C# 9"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/388dae0ca9df603c88b5e41e29cf2d4d","name":"Francesco Vastarella","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3b8deedae8f35372d5fba49f918006fb0a58a2943aff6ae52d3ff188e0c441bb?s=96&d=identicon&r=g","caption":"Francesco Vastarella"},"url":"https:\/\/blexin.com\/en\/author\/francesco-vastarellablexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-8tD","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2021\/03\/7_21_1105x656_blog-c9record.png?fit=1105%2C656&ssl=1","_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/32589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716244"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=32589"}],"version-history":[{"count":8,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/32589\/revisions"}],"predecessor-version":[{"id":32662,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/32589\/revisions\/32662"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/32564"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=32589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=32589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=32589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}