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);
  • Perhyte@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    Type aliases already existed, and already used the using keyword. This version essentially just adds a few new options for the bit after the = (to be specific: tuple types, array types, pointer types, or other unsafe types).