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);
  • @douglasg14b
    link
    21 year ago

    A codebase is different than the language itself enabling many ways to do the thing.

    You may not think it’s likely to cause problems, but have you actually onboarded non c# devs onto new C# projects?

    I have been for the last 6 months and let me tell you it really opened my eyes to new problems. One of those is that there are many ways to do the same thing, which has been a consistent pain point for non-c# devs, and has been hurting adoption and general sentiment.

    Honestly I didn’t think much of it till now, and didn’t think it would be that big of a deal. Turns out it is.

    • Kogasa
      link
      01 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.