build 2017 - b8104 - the future of c#

Post on 22-Jan-2018

861 Views

Category:

Software

4 Downloads

Preview:

Click to see full reader

TRANSCRIPT

@MadsTorgersen, @dcampbell

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

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

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

Demos!

More demos!

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

foreach await (var p in people) { … }

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

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); }

}

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);

@roslyn @dcampbell @MadsTorgersen

top related