What is new in c# 9. How we can use it in programming

What is new in c# 9. How we can use it in programming 


There are new features in the last few versions of C# had made it easy to write shorter and simpler code. C# 9 is no exception to that. Records, new types of syntax, and more other features can make your code much more expressive. In certain cases, you can avoid writing a lot of more code that was previously needed. C# 9.0 introduces record types. You use the record keyword to define a reference type that provides built-in functionality for encapsulating data.

provides built-in functionality for encapsulating data:

 public record Person(string First_Name, string Last_Name); property definition of Positional syntax

 Exp :Person person = new("Nancy", "Davolio");

  Immutability :


Immutability can be useful when you want a data-centric type to be thread-safe or a hash code to remain the same in a hash table. 

Nondestructive mutation and more new features. C# 9 also allow you to use a more specific return type when overriding base class members. And C# 9 also allow you to use a more specific return type when implementing interfaces,




Read More....



















Comments