<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Patricio Filice</title>
    <description>The latest articles on DEV Community by Patricio Filice (@patriciofilice).</description>
    <link>https://dev.to/patriciofilice</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F795686%2Faa7d329e-bc7a-42ca-b2d1-259d41991827.jpeg</url>
      <title>DEV Community: Patricio Filice</title>
      <link>https://dev.to/patriciofilice</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/patriciofilice"/>
    <language>en</language>
    <item>
      <title>C# Sugar &amp; Improvements [6.0 to 10.0]</title>
      <dc:creator>Patricio Filice</dc:creator>
      <pubDate>Tue, 25 Jan 2022 18:58:03 +0000</pubDate>
      <link>https://dev.to/cloudx/c-sugar-improvements-60-to-100-1ge9</link>
      <guid>https://dev.to/cloudx/c-sugar-improvements-60-to-100-1ge9</guid>
      <description>&lt;p&gt;Hi everyone, just like me you came across to different projects with different versions of C# so is a common issue to forget the new features, the amenities of the version we are using.&lt;br&gt;
So to ammend that I made something more interactive than an image or a post, a project with examples, were you can run and see step by step each one of the features incorporated in each version, most of them are related with sugar sintax the others are new tools to simplify our work.&lt;br&gt;
As an extra there is a url for each addon and C# version description. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can click &lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements" rel="noopener noreferrer"&gt;here&lt;/a&gt; to access the repo with the project&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;p&gt;For a more detailed explanation of what's new on each version: &lt;/p&gt;

&lt;p&gt;C# 10.0&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp10/AssignmentAndDeclarationCSharp10.cs" rel="noopener noreferrer"&gt;Assignment and declaration:&lt;/a&gt;&lt;/u&gt; There was a restriction where you couldn't mix the declaration and assignment of variables on the same line, that restriction was lifted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp10/FileScopedNamespaceCSharp10.cs" rel="noopener noreferrer"&gt;File scoped namespace:&lt;/a&gt;&lt;/u&gt; Is a reduced way to declare a namespace saving space horizontally and vertically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;(PREVIEW)&lt;/strong&gt; &lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp10/Preview/GenericAttributesCSharp10.cs" rel="noopener noreferrer"&gt;Generic attributes:&lt;/a&gt;&lt;/u&gt; As the name implies now is possible to create attributes based on a generic declaration, there are some limitations, and it can change on the final release but is a good tool to check on.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;C# 9.0&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp9/RecordCSharp9.cs" rel="noopener noreferrer"&gt;Record:&lt;/a&gt;&lt;/u&gt; A new positional data type intended to be non mutable with its own traits closing a little more the gap with functional programming.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp9/TargedTypedCSharp9.cs" rel="noopener noreferrer"&gt;Targeted type:&lt;/a&gt;&lt;/u&gt; Reduces the redundant declarations when a type is implicit.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;C# 8.0&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp8/ArrayCSharp8.cs" rel="noopener noreferrer"&gt;Indexes and ranges for arrays:&lt;/a&gt;&lt;/u&gt; Its quicker and simpler to retrieve a specific element or a segment from an array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp8/NullCoalescingCSharp8.cs" rel="noopener noreferrer"&gt;Null coalescing:&lt;/a&gt;&lt;/u&gt; Reduces the checking and assignment when null is involved and wants to be avoided.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp8/PatternMatchingCSharp8.cs" rel="noopener noreferrer"&gt;Pattern matching:&lt;/a&gt;&lt;/u&gt; Allows more advanced conditional statements, involving a syntax similar to functional pattern matching.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp8/UsingCSharp8.cs" rel="noopener noreferrer"&gt;Using disposal:&lt;/a&gt;&lt;/u&gt; Eliminates the boilerplate declaration for disposables, for a block or a full method declaration.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;C# 7.0&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp7/BodiedExpressionCSharp7.cs" rel="noopener noreferrer"&gt;Bodied expression in a class:&lt;/a&gt;&lt;/u&gt; It's possible to use bodied expressions when declaring a constructor o destructor for a class.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp7/IsOperatorCSharp7.cs" rel="noopener noreferrer"&gt;Is operator for casting:&lt;/a&gt;&lt;/u&gt; The &lt;code&gt;is&lt;/code&gt; operator was extended to allow outputting the casting result wich allows to reduce the needed code lines to check and use a casting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp7/LocalFunctionCSharp7.cs" rel="noopener noreferrer"&gt;Local function:&lt;/a&gt;&lt;/u&gt; We can declare our own methods inside the declaration of another method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp7/OutVariableCSharp7.cs" rel="noopener noreferrer"&gt;Out parameter with inline declaration:&lt;/a&gt;&lt;/u&gt; There is no further need to declare a variable before storing the value, we can declare and output to it on the same line.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;C# 6.0&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp6/NameOfCSharp6.cs" rel="noopener noreferrer"&gt;Name of:&lt;/a&gt;&lt;/u&gt; We can bind compile checking of a code definition (class, properties, variables, etc.) avoiding maintainability problems when plain text is related to an existing definition.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp6/NullSpredCSharp6.cs" rel="noopener noreferrer"&gt;Null spreading:&lt;/a&gt;&lt;/u&gt; A way to avoid boilerplate null checking.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;&lt;a href="https://github.com/Patricio-Filice-CloudX/CSharp-Sugar-And-Improvements/blob/master/CSharp6/StringInterpolationCSharp6.cs" rel="noopener noreferrer"&gt;String interpolation:&lt;/a&gt;&lt;/u&gt; A less laborious way to dynamically format a string.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>csharp</category>
      <category>cheatsheet</category>
      <category>programming</category>
      <category>sugarsyntax</category>
    </item>
  </channel>
</rss>
