Build 2017 - B8104 - The Future of C#

15

Transcript of Build 2017 - B8104 - The Future of C#

Page 1: Build 2017 - B8104 - The Future of C#
Page 2: Build 2017 - B8104 - The Future of C#

@MadsTorgersen, @dcampbell

Page 3: Build 2017 - B8104 - The Future of C#

stackoverflow.com/insights/survey/2017#most-popular-technologies

Page 4: Build 2017 - B8104 - The Future of C#

stackoverflow.com/insights/survey/2017#most-loved-dreaded-and-wanted

Page 5: Build 2017 - B8104 - The Future of C#

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

Page 6: Build 2017 - B8104 - The Future of C#

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

Page 7: Build 2017 - B8104 - The Future of C#

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

Page 8: Build 2017 - B8104 - The Future of C#

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

Page 9: Build 2017 - B8104 - The Future of C#

Demos!

More demos!

Page 10: Build 2017 - B8104 - The Future of C#

IAsyncEnumerable<Person> people = database.GetPeopleAsync();

foreach await (var p in people) { … }

using await (IAsyncDisposable resource = await store.GetRecordAsync(…)) { … }

Page 11: Build 2017 - B8104 - The Future of C#

extension Enrollee extends Person{

// static fieldstatic Dictionary<Person, Professor> enrollees = new Dictionary<Person, Professor>();

// instance methodpublic void Enroll(Professor supervisor) { enrollees[this] = supervisor; }

// instance propertypublic Professor Supervisor => enrollees.TryGetValue(this, out var supervisor) ? supervisor : null;

// static propertypublic static ICollection<Person> Students => enrollees.Keys;

// instance constructorpublic Person(string name, Professor supervisor) : this(name) { this.Enroll(supervisor); }

}

Page 12: Build 2017 - B8104 - The Future of C#

class Person : IEquatable<Person>{

public string First { get; }public string Last { get; }

public Person(string First, string Last) => (this.First, this.Last) = (First, Last);

public void Deconstruct(out string First, out string Last) => (First, Last) = (this.First, this.Last);

public bool Equals(Person other) => other != null && First == other.First && Last == other.Last;

public override bool Equals(object obj) => obj is Person other ? Equals(other) : false;public override int GetHashCode() => GreatHashFunction(First, Last);…

}

class Person(string First, string Last);

Page 13: Build 2017 - B8104 - The Future of C#
Page 14: Build 2017 - B8104 - The Future of C#

@roslyn @dcampbell @MadsTorgersen

Page 15: Build 2017 - B8104 - The Future of C#