18
Why you Should Take Another Look at C# Mads Torgersen @MadsTorgersen

Why you Should Take Another Look at C# - GOTO Bloggotocon.com/.../slides/MadsTorgersen_WhyYouShouldTakeAnotherLo… · Why you Should Take Another Look at C# ... Edit in Visual Studio

  • Upload
    ledan

  • View
    222

  • Download
    1

Embed Size (px)

Citation preview

Why you Should

Take Another Look at C#

Mads Torgersen@MadsTorgersen

http://stackoverflow.com/research/developer-survey-2016#technology-most-popular-technologies

http://stackoverflow.com/research/developer-survey-2016#technology-most-loved-dreaded-and-wanted

Run on Windows

Black box compilers

Edit in Visual Studio

Proprietary

Run everywhere

Open compiler APIs

Use your favorite editor

Open source

There should

need to be only

one code base in the world for

understanding C#

Evolution of C#

C# 1

Hello World

C# 2

Generics

C# 3Queries, Lambdas

C# 4Dynamic, Concurrency

C# 5

Async

C# 6Eliminate ceremony

C# 7

Work with data

if (o is Point(5, var y)) { WriteLine($"Y: {y}"); } // recursive patterns

state = match (state, request) // match expressions, match on tuples{

(Closed, Open) => Opened,(Closed, Lock) => Locked,(Opened, Close) => Closed,(Locked, Unlock) => Closed,

};

string? n; // Nullable reference type

string s; // Non-nullable reference type

n = null; // Sure; it's nullable

s = null; // Warning! Shouldn’t be null!

s = n; // Warning! Really!

WriteLine(s.Length); // Sure; it’s not null

WriteLine(n.Length); // Warning! Could be null!

if (n != null) { WriteLine(n.Length); } // Sure; you checked

WriteLine(n!.Length); // Ok, if you insist!