From c8674bfe38d3afd861d27c64779fe05f1c2d4ac7 Mon Sep 17 00:00:00 2001 From: Andrei Ignat Date: Thu, 30 Nov 2023 17:19:15 +0200 Subject: [PATCH] more examples --- .../code/WhatsNewC12/WhatsNewC12/Program.cs | 12 +++++++++++- 2023/Net8WhatsNew/presentation/NET8WhatsNew.html | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/2023/Net8WhatsNew/code/WhatsNewC12/WhatsNewC12/Program.cs b/2023/Net8WhatsNew/code/WhatsNewC12/WhatsNewC12/Program.cs index 61bcb8b5..fb095b3d 100644 --- a/2023/Net8WhatsNew/code/WhatsNewC12/WhatsNewC12/Program.cs +++ b/2023/Net8WhatsNew/code/WhatsNewC12/WhatsNewC12/Program.cs @@ -1,5 +1,7 @@ // https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12 using WhatsNewC12; +using static System.Runtime.InteropServices.JavaScript.JSType; +using Point = (int x, int y); Console.WriteLine("More differences at https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12"); Console.WriteLine("record vs class"); var pc=new PersonClass("Ignat", "Andrei"); @@ -10,4 +12,12 @@ Console.WriteLine(pr.firstName); //this does not exists - because it is a class! //Console.WriteLine(pc.LastName); -Console.WriteLine(pr.lastName); \ No newline at end of file +Console.WriteLine(pr.lastName); +Point p=new(1,2); +Console.WriteLine(p.ToString()); + +int[] a=[1,2,3]; +List b = [1,2,3]; +int[] moreNumbers = [.. a, .. b, 7, 8, 9]; +//Dictionary c = [1:"one", 2:"two", 3:"three"]; + diff --git a/2023/Net8WhatsNew/presentation/NET8WhatsNew.html b/2023/Net8WhatsNew/presentation/NET8WhatsNew.html index 159174b5..8ed1234f 100644 --- a/2023/Net8WhatsNew/presentation/NET8WhatsNew.html +++ b/2023/Net8WhatsNew/presentation/NET8WhatsNew.html @@ -113,6 +113,8 @@ Primary constructors and differences for record (DEMO) + Alias for any type ( DEMO ) + Collection literals (DEMO ) Interceptors ( see asp.net core 8 for examples of MapGet ,MapPost ...)