O Futuro do C#: C#8
-
Upload
giovanni-bassi -
Category
Technology
-
view
82 -
download
0
Transcript of O Futuro do C#: C#8
www . l am b d a 3 . c om . b r
O futuro do C#
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
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:
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
Demos!
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
static (int, int) Tally(int[] values) => default;
https://github.com/dotnet/csharplang/blob/master/proposals/target-typed-default.md
static async Task Main()
{
// await ...
}
https://github.com/dotnet/csharplang/blob/master/proposals/async-main.md
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);