Mar 18 2024
//Before var integers = new int[] { 1,2,3,4,5 }; var list = new List<int>() { 1,2,3,4,5 }; var fruits = new List<string>() {"apple", "banana", "cherry"}; //After int[] integers = [ 1,2,3,4,5 ]; List<int> list = [ 1,2,3,4,5 ]; List<string> fruits = ["apple", "banana", "cherry"];
public class User(string firstName, string lastName, int age, List<Role> roles) { public string FirstName => firstName; public string LastName => lastName; public int Age => age; public List<Role> => roles; }
using System.Runtime.CompilerServices; [InlineArray(5)] public struct FixedArray { private int _element; // Usage var buffer = new FixedSizeBuffer(); for (int i = 0; i < 5; i++) buffer[i] = i; }
// possible only with C# 12 using Point = (int x, int y); Point origin = (0, 0); Console.WriteLine(origin);
public static void WelcomeUser(string username = "Guest") { Console.WriteLine($"Welcome, {username}!"); } WelcomeUser();
var WelcomeUser = (string username = "Guest") => Console.WriteLine($"Welcome, {username}!"); WelcomeUser();
1. Design Patterns that Deliver
This isn’t just another design patterns book. Dive into real-world examples and practical solutions to real problems in real applications.Check out it here.
Go-to resource for understanding the core concepts of design patterns without the overwhelming complexity. In this concise and affordable ebook, I've distilled the essence of design patterns into an easy-to-digest format. It is a Beginner level. Check out it here.
Every Monday morning, I share 1 actionable tip on C#, .NET & Arcitecture topic, that you can use right away.
Join 18,000+ subscribers to improve your .NET Knowledge.
Subscribe to the TheCodeMan.net and be among the 18,000+ subscribers gaining practical tips and resources to enhance your .NET expertise.