New features in C# 7
Test suite of new features in C# 7
This repo contains a list of new features in C# 7. Examples are heavily influenced from StackOverflow documentation as well as this MSDN blog post.
Topics covered
- Binary Literals
- Local Functions
out var
declarations- Pattern Matching
ref local
andref return
- Throwing exceptions
- Tuples
- ValueTask
Examples
Introduces object deconstruction, expression bodies and ValueTuples
class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public (string First, string Last) FullName => (FirstName, LastName);
public void Deconstruct(out string first, out string last)
{
first = FirstName;
last = LastName;
}
}