O Futuro do C#: C#8

16
www.lambda3.com.br O futuro do C#

Transcript of O Futuro do C#: C#8

Page 1: O Futuro do C#: C#8

www . l am b d a 3 . c om . b r

O futuro do C#

Page 2: O Futuro do C#: C#8

Giovanni Bassi•Programador

•MVP

•Não gerente

• Trouxe a Scrum.org, PSM e PSD pro Brasil

•blog.lambda3.com.br, podcast.lambda3.com.br, dotnetarchitects.net

•@giovannibassi

• Escalador e ciclista

Page 3: O Futuro do C#: C#8
Page 4: O Futuro do C#: C#8

podcast.lambda3.com.br

0 – Eventos1 – Docker2 – .NET Core RC23 – Git4 – Estudo5 – Open Source6 – Xamarin7 – Node.js8 – Democracia organizacional9 – O programador poliglota...

Toda semana em:

Page 5: O Futuro do C#: C#8

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

Page 6: O Futuro do C#: C#8

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

Page 7: O Futuro do C#: C#8

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

Page 8: O Futuro do C#: C#8

F#10,000’sTens of thousands

VB100,000’sHundreds of thousands

C#1,000,000’sMillions

Page 9: O Futuro do C#: C#8

Demos!

Page 10: O Futuro do C#: C#8

var tuple = (f1: x.f1, f2: x?.f2);

var tuple = (x.f1, x?.f2);

https://github.com/dotnet/csharplang/blob/master/proposals/csharp-7.1/infer-tuple-names.md

Page 11: O Futuro do C#: C#8

static (int, int) Tally(int[] values) => default;

https://github.com/dotnet/csharplang/blob/master/proposals/target-typed-default.md

Page 12: O Futuro do C#: C#8

static async Task Main()

{

// await ...

}

https://github.com/dotnet/csharplang/blob/master/proposals/async-main.md

Page 13: O Futuro do C#: C#8

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

foreach await (var p in people) { … }

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

Page 14: O Futuro do C#: C#8

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 15: O Futuro do C#: C#8

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 16: O Futuro do C#: C#8