Skip to content

C# 7.0

Highlights

  • Tuples with named elements: (int sum, int count) Foo()
  • Deconstruction: var (x, y) = point;
  • Pattern matching (is, switch): type, constant, and var patterns
  • Out variables: int.TryParse(s, out var value)
  • Local functions: Nested helper methods with lexical scope
  • Ref returns and locals: Return by reference to avoid copies
  • Throw expressions: x ?? throw new ArgumentNullException(nameof(x))
  • Digit separators and binary literals: 1_000_000, 0b1010_1010