2

New features for those who haven't seen them:

// Primary constructors
public class NamedItem(string name)
{
    public string Name => name;
}

// Default lambda params
var IncrementBy = 
    (int source, int increment = 1) => 
        source + increment;

Console.WriteLine(IncrementBy(5)); // 6
Console.WriteLine(IncrementBy(5, 2)); // 7

// Type aliases
using Point = (int x, int y);
you are viewing a single comment's thread
view the rest of the comments
[-] kogasa@programming.dev -1 points 1 year ago

Onboarding them onto... what? Out of the billions of possible standards and practices to adopt, you are either showing them which to use, or letting them pick. There is usually not a single right way to do something. This isn't exclusive to C#. Language features are only a tiny subset of the functionality a programming language is used to build.

this post was submitted on 21 Jun 2023
2 points (100.0% liked)

C Sharp

1527 readers
1 users here now

A community about the C# programming language

Getting started

Useful resources

IDEs and code editors

Tools

Rules

Related communities

founded 1 year ago
MODERATORS