HomeЛюди и блогиRelated VideosMore From: Microsoft Developer

The future of C# : Build 2018

872 ratings | 61286 views
Over the last year we shipped no less than three "point releases" of C# (7.1, 7.2 and 7.3), full of small but useful language features. Mads and Dustin will race you through a tour of these, before turning to some of the big things we have in store for the future: Nullable reference types, recursive patterns, asynchronous streams and more.
Html code for embedding videos on your blog
Text Comments (148)
Zergling (28 days ago)
The nullable reference type stuff is amazing. Finally I won't have to constantly bitch at my coworkers to fucking null check their god damn fucking shit over and over and over and over and then have to deal with the fallout and bullshit when they don't. The compiler will do that for me.
superstringcheese (1 month ago)
If I was doing a code review and saw that new switch pattern they ended up with, I'd make the developer convert it all to a conventional switch. That is one of the most arcane blocks of code I've ever seen.
Jean Roch (2 months ago)
That range literal at 58:28 is coming straight from VHDL 😁
Jean Roch (2 months ago)
I love their energy :-)
Nick Donnelly (2 months ago)
guys AT LEAST 1080, better 4K - so we can actually read the code!
What's that console he's using?
Predatora (4 months ago)
You may add a view window to represent functional dependencies & relations & conneects in a class to see all structure as an instance schema.
Predatora (4 months ago)
I want C# will be everywhere. Even it should take the place of javascript. Because it's the most functioned & logical language. For this, adding ideas in this video, Microsoft should imrove it by doing these first: - Simplifying syntax - Deal with chip manufacturers to implement C# <- if so C# should have serious advantages according to C - Any program writtein in C# can be converted to languages of smartphones & mini devices. For this Visual Studio must have an A.I to add/modify some code.
dppage (4 months ago)
C# needs a write-once, run everywhere GUI development environment. Xamarin doesn’t cut it. Xamarin Forms had potential, but they’ve made it clear that they aren’t interested in supporting MacOS after talking it up for a couple of years, and it’s so buggy it’s one of the most dreaded platforms on a stack overflow survey. Folks are still jumping to electron, react native, etc.
chidiebere Joshua (4 months ago)
What's the future of VB.NET?
harrod harrod (4 months ago)
shouldn't the last be ^0? Kinda coutnerintuitive indexing from 0, but from 1 when coutning backwards
Marcos Beni (5 months ago)
The nullable types feature is awesome and long overdue. However, not looking forward to that return switch monstrosity though; can you guys like... skip it? That stuff is impossible to read.
harrod harrod (4 months ago)
I think it was fairly readable up until they started doing the recursive patterns thingy with it.
Valentino Pereira (5 months ago)
I'm a JavaScript Developer and I am lost here...
Stuart Ross (5 months ago)
Like the string range function but why use ^ to refer to the end as this is the beginning in regular expressions shouldn’t it be $
Валентин Т (5 months ago)
13:29 How did he edit GrabBag.csproj file without unloading it? I have no such item in popup menu. Some kind of extension?
Luke (5 months ago)
So apparently you bringing back pointer algorithm in a way, just a little safer?
Martin Kráľ (5 months ago)
Vars are plague of every coding language. So much effort to write INT instead of VAR.
Ben Perry (5 months ago)
This is all cool stuff, but I'm starting to get worried about the growing complexity of this language.
vinzer72frie (17 days ago)
Thats a good thing, pay stays if not gets higher
synetic707x (5 months ago)
Love C#, C++ and Rust :)
Petter (5 months ago)
Wish there was a TLDR of this stuff. Or if it was chopped so you dont have to watch it all in one sitting.
sleeeptube (5 months ago)
Perahoky (5 months ago)
07:25 my teacher once said, "on a power point presentation, just keep only 5 words at once at a time on a page!" e.g. Strategy 1. Growing 2. Innovation 3. Improvements for all 4. Broader Ecosystem
Mamunur Rashid (5 months ago)
C# is awesome!!!
just chill out with the new versions... or you're gonna turn into java
Doru/Friuns (5 months ago)
fix refs for anonymous methods
Synaxis (5 months ago)
would i have to download 3.5 gb
/ void / (5 months ago)
No it will magically fly through the air.
Nolan yoyo (5 months ago)
Whats it do, dont have a hour to find out
Alex B. (5 months ago)
Whoaaaa, new keywords! C# was certainly lacking those.
Vitalii Yarema (5 months ago)
I am looking for a H1B job in USA as the C# .NET developer. Threre are a lot of such vacancies for Java developers but too few for C# .NET developers. I know a lot of people got H1B visas as Java developers, but nobody as the C# .NET developer from my country (Ukraine). But there are a lot of jobs for C# .NET developers in Ukraine. Does this mean that in the USA C# .language is much less popular than in others countries? May be I need to migrate to Java language to get H1B visa? I know even such a fellow from Ukraine who got job as the Java developer in Microsoft company!!!???
glitch (5 months ago)
JavaScript is not a programming language itself because it's interpreted Edit: nvm I watched the video further, I got it, he let it there but should've, perfect explanation what JS is
Azez Nassar (2 months ago)
Good joke.
Synaxis (5 months ago)
Steven Akinyemi (5 months ago)
Javascript is not a programming language? You are kidding right? You have to be.
I dont do birthdays (5 months ago)
I have been waiting for that switch expression syntax for years!
Szalay István (5 months ago)
That many syntactic sugar can cause syntactic diabetes and syntactic obesity :)
devoiddude (5 months ago)
binaryalgorithm (5 months ago)
I did a lot of C#, then recently took a Java position. Not even close on language features, ease of use, and the IDE...
Jean Roch (2 months ago)
I hope your code is less ambiguous than your comments.
Azez Nassar (2 months ago)
Whats not close? Java or C#?
Hazz Sin (4 months ago)
Honestly, I have used both and love features from both languages. I love java's "final", but I also love c# properties and static classes. I could probably sit here all day lamenting on the best features from both languages, dreaming of a hybrid language that used the best features from both. Alas, it will be a dream. Still, I love interesting challenges like making a chess engine in java, and then in c#. You really get a feel for the similarities and differences between both languages, and the particular focus each language has.
Mike Sheen (5 months ago)
@Steven Akinyemi No, not duh - it's not clear what @binaryalgorithm was saying. Many a Java advocate would have assumed the opposite to your assertion. I'm a C# guy, but I've seen my share of religious debates over C# vs Java to make @binaryalgorithm 's statement ambiguous. PS: My statement was in jest - in that if the post by @binaryalgorithm was ambiguous then obviously they're in the Java camp as that's not the nature of C# devs.
Steven Akinyemi (5 months ago)
Duh, (s)he meant Java isn't close on language features, ease of use, ...
Prabhath Amaradasa (5 months ago)
Little stolen from python...:)
Kareshi (5 months ago)
That table showing Rust as a very loved language is just BS, Rust evangelists have been flooding the internet with their silly attempts at pushing their stupid language , reddit is already full of these bastards
Doan Bui (5 months ago)
i need sub pls
TaoriUTS (5 months ago)
was hoping for a demo of concept :(
SergeKG2 Kg (5 months ago)
Please add possibility use references on properties
Ashok Karasala (5 months ago)
You guys are awesome.... I am waiting for the day to become like one of you.
Shin Kansen (5 months ago)
Nice guys but a kludge of a language. The syntax is so noisy, why not do it in C++ and get the benefit of speed?
Shin Kansen (5 months ago)
It's not about 5 or 10%, but you have to make it work within a certain amount of time or memory. By the way if typing speed is your criteria, I don't think you're into real programming.
Braed (5 months ago)
It's not even about that though, it's about how long it would take to write it. C# is much faster to write and will have less bugs, that's just a fact. If you want to chase a 5 or 10% performance gain for a web server, go ahead, waste your time.
Shin Kansen (5 months ago)
Yes, C++ is not for every programmer. Only the good ones would benefit.
Braed (5 months ago)
Uh, because C++ takes twice as long to write, is harder to learn and isn't safe?
Magos X (5 months ago)
In the same way you specify nullable types with questionmark like "int? x", couldn't you specify non-nullable types with exclamationmark like "string! x"?
You want non-nullabe by default, preferrebly with no noise
Just Nothing (5 months ago)
return (middleName ?? "").Length;//this is how it should be done.
Zergling (28 days ago)
Don't you mean return middleName?.Length ?? 0
Onur Şahin (5 months ago)
all these new things with ref sounds like const refences in c++
they are more like references in rust, cause they are safe
IT Amazing (5 months ago)
I like it.
Vindignatio (6 months ago)
@41:20 I think null reference exceptions are a debugging problem not a language problem. If the exception included what method was trying to be called with the null reference it would be way better. I know the variable that is null might not be known (+ optimizations)(or even exist if chaining methods), but you know what method was being called on a null object.
Brad Ford (5 months ago)
It's a matter of communicating intent (especially to the compiler), a reference CANNOT be null, therefore dereferencing is safe... this is a long overdue feature. I believe that Anders has been asked the question many times and the response was he was unsure 'how' to implement without breaking the language [existing code] (as they are suggesting to do now).
Robert Sundström (6 months ago)
Nice to see that C# is evolving and diverging from the rest of the C-family. More functional. Less Java. Next step: Removing curly braces! Just kidding ;) It's really a living modern programming language!
Span and Range(index Backwards with..^) reminds me a lot of the nim-lang but there must be a lot of languages that implement it like that.
Green Screen (6 months ago)
Except for Span, Memory and nullable references the rest is terrible and will confuse everyone. That switch wasn't even shorter. It was just obfuscated...
Green Screen (5 months ago)
Turning it into expression body gives absolutely no benefit here. Also, who uses so many switches that they need a shorter way to write it anyway? Going into more functional style of programming will make C# much more difficult to read. I would give C# team a break and focus on moving .NET to other platforms, because even though they say you can, it is still a very different experience than writing code for windows/iis and needs a lot of polishing.
Brad Ford (5 months ago)
You might have not noticed (re: the switch) that by turning it into a return, that he could have gone on and made it an expression body, which is more 'functional like'. I am sure the jury is still out on it as far as the syntax (especially the recursive aspect, which I am not a big fan of), but the nice thing is that if you don't like it, you can still use the existing method.
rockydirt (6 months ago)
lol... I don't understand why they troll JavaScript.
Mike Sheen (5 months ago)
Two different paradigms / philosophies. C# is a strongly typed philosophy - so javascript is the obvious target from the C# camp. I'm firmly in the C# camp, myself. I don't hate javascript, but I don't like it. Thankfully WebAssembly is gaining traction.
Lufen Martofilia (5 months ago)
Really constructive
Clingfilm Productions (5 months ago)
cause it sucks
Michael DeMond (6 months ago)
What an excellent session. Very appropriate for an excellent language. :)
Wisnu 77 (6 months ago)
C# is rock....i like it...
TheMonk72 (6 months ago)
Oh, did you just implement const parameters in C#?
tecgoblin (6 months ago)
I've faced a case where I needed an Asynchronous Stream, and it was frustrating that I had to resort to normal for loops. Go C# :)
Robert McAlery (6 months ago)
Looks like the C# team is working overtime trying to bring F# capabilities into C#. Just have a look at the return switch pattern matching @48:00. They're trying to emulate F#'s expression based pattern matching mechanism, as seen below: Proposed C# syntax: return person switch { Professor p => ... , Student s => ... , Person p when ... => ... , _ => ... } Existing F# syntax: match person with | Professor p -> ... | Student s -> ... | Person p when ... -> ... | _ -> Similarly with all the deconstruction related pattern matching stuff. It's all copied from F#. Like they say: "Imitation is the sincerest form of flattery". NOTE: The big difference is that F# has exhaustive pattern matching. C#'s version is NOT exhaustive, making it far less powerful, as the compiler won't warn you of any missed matches.
A1samo (3 months ago)
F# is not increasing in popularity nor being adopted so focusing on C# which is widely adopted and very popular is the wise thing to do
Dhruv Rajvanshi (4 months ago)
How do you figure C# version doesn't have exhaustiveness checking? The code they showed was exhaustive so we didn't see any warnings but I don't see any reason why the C# version couldn't be checked for exhaustiveness.
lrhlpz (5 months ago)
C# is gaining some functional things, but it is not a functional language. F# is and will be better as FL.
Milligram (6 months ago)
Microsoft, please stop making C# so awesome! We need more frustrated converts to F#! ;)
Asti R (5 months ago)
This is so true. Much less motivation to write simple tools in F# now.
Milligram (5 months ago)
I love C# too! It's the best OOP language I've ever used and it's very popular in the industry so I consider myself lucky considering it could have been a lot worse!
lrhlpz (5 months ago)
F# is still awesome, I love c# and f#, both are great.
Francesco Belacca (6 months ago)
That is indeed awesome. Lots of stuff are great, i believe legacy code will benefit incredibly by combining the new nullable checks on strings, LinqToForeach\For and viceversa, or even the "fix all in the solution" in combo with .editorconfig... So much great stuff! P.S. the substing with .. is mindblowing
The Werewolf (6 months ago)
Dear God.. that new return/switch thing is hideous. Was someone trying to win an obfuscated code contest? Less clearly isn't always more.
BigSleepyOx (1 month ago)
Recursive pattern matching is great in F#, and you don't need to necessarily "read it" in an imperative fashion, it's more declarative. You guys just aren't used to it. I hope they don't kill the feature due to outcry from folks not used to functional idioms, that would be a shame.
Kagemand Andersen (2 months ago)
Maybe it's because I've used F#, but I think it's neat. I loved pattern matching in F# and was overjoyed when they brought it to C#. However, one reason why I haven't used pattern matching much in C# was because of how bloated it felt. Now, to me anyways, it's concise while still being readable.
dnavas77 (3 months ago)
@Hong: you're a smart man. The syntax is amazing. I really like that they are borrowing features from functional languages. It just makes C# future proof.
Hong (5 months ago)
Actually, that's just pattern matching. C# is simply becoming more and more functional. In fact, I believe in the future, there will be no distinct line between functional and imperative language. Functional does not mean it has to be hard to read. It's supposed to be more descriptive.
Justin Minnaar (5 months ago)
It is imperative that programmers make their choice readable, as we spend significantly more time reading code than writing it. C# needs to focus more on making code simple to read, easy to understand, and SOLID principles. Contracts in the code would help too. I'll fire the first of my team that writes this messy code.
hl2mukkel (6 months ago)
1:00 "This is becoming traditional, C# has a future and we're going to talk about it" _audience laughs_
suhuy2008 (6 months ago)
The default implementation mimics a little bit the Haskell type classes. There you can define one operation of a type class using another one. What would happen if I created a mutually recursive definition in the new c#? interface IFoo<T> { bool Equal (T a, T b) => ! DoNotEqual(a, b,); bool DoNotEqual(Ta, Tb) => ! Equal(a, b); }
Hong (5 months ago)
it can also be used as a MixIn style, something like Trait in Scala
Kai (5 months ago)
or, closer to the haskell example, you could use parametric polymorphism in C# too! void MyFunc<T>(T t) where T : IShow => Console.WriteLine(t.Show()); in this case, you are literally working with a type variable that has an interface constraint on it, similar to how you can add typeclass constraints in haskell. the sad part is that C# can't deal with higher kinded types, but this is still a cool development!
suhuy2008 (6 months ago)
One answer is enough 😉. Hypothetically, the compiler can check if at least one of methods is implemented and use it for the other one. In this case, any method is enough to implement this interface. IMO, type-classes are the functional equivalent of interfaces. Let say, you have a polymorphic function, it takes an argument, that is constrained to a type-class. This is the same as a c# method that accepts an interface instance. In case of Haskell, you are able to use type-class functions applied to a function argument. In case of C#, you are able to invoke interface methods of the argument. --Haskell class Show a where show :: a -> String myFunc :: Show a => a -> IO () myFunc x = putStrLn $ show x //c# interface IShow { string Show(); } void MyFunc(IShow x) => Console.WriteLine(x.Show());
wertrager (6 months ago)
You can't do that, which of those would be the default? Typeclasses are something else, they generate constraints and not types.
wertrager (6 months ago)
You can't do that, which of those would be the default? Typeclasses are something else, they generate constraints and not types, or virtual types.
Ryan Crosby (6 months ago)
That return switch syntax is so cool!
Kerim Emurla (5 months ago)
Yes, Kotlin does the same thing with "when" expression and I love it.
Neme (5 months ago)
It's not a "return switch" syntax. It's a switch expression and you can use it anywhere you can use an expression. For example: `var result = person switch {...};` or `Console.WriteLine(person switch { ... })`
wertrager (6 months ago)
Please do Nullable, Records, Either, Union Types for 8.0, then for 9.0-10.0 plan for Dependent Types (possibly by inlining parts of Roslyn with the type declaration), this would allow for Multiparty Session Types, which are BetterBestest)
Денис Продан (6 months ago)
How about discriminated unions and pattern matching that will have error/warning in non-exhaustive cases set?
Денис Продан (5 months ago)
Why not? Most of significant features since 3.0 adopted from FP or at least “neutral” (not related to OOP). Lambda functions + Linq. Type inference, tuples, records, pattern matching, null-propagation etc Async/await + tasks adopted from F# and they’re behave like IO Monad from Haskell. Not-null by default is also from FP, I can’t remember any more or less well-known OOP language with it. Besides that, this feature is really useful. Now I have to write in switch-case something like default: throw new NotImplementedException(); And get these exceptions in runtime if new option is added and not handled. With warnings/errors I’ll be able to write totally safe code here - compiler won’t miss unhandled case.
lrhlpz (5 months ago)
I don't think so, you are seeing it like "c# will be f# in the future", but it is not. C# will get any feature that is relevant to object oriented programming, not because f#.
Robert McAlery (6 months ago)
I'm sure they're looking into it. They just need more time to see how the F# implementation can be implemented in C#.
wertrager (6 months ago)
Union types yes. I'm was wondering during the talk, could it be possible to implement Either using the ref returns, but I don't think it's possible without changing the runtime. Ceylon has a great syntax for this. https://ceylon-lang.org/documentation/1.3/spec/html_single/#unionandintersectiontypes
André Köhler (6 months ago)
Why do we need default implementations in interfaces when we already have abstract classes for this? This sounds like language bloat to me.
pickedupapencil (5 months ago)
I feel like they're trying to fix the lack of multiple inheritance with classes with all these little hacks.
hblaub (5 months ago)
Brad Ford exactly: what is this weird benefit justifying this not-so-easy change? It will be more complicated for tools/reflection too
Brad Ford (5 months ago)
I also currently use extension methods (on the interface) to add to an existing interface (perform the same basic function)... Like it (default implementation), but I am concerned that they need to change the CLR to implement
hblaub (6 months ago)
In Java 8, the JRE got Streams and a new functional approach - very useful but sadly not defined on Collection<T> and such interfaces - so they introduced "default methods" and added ".stream()" to Java's collection interfaces. But in C# / .NET 3.5, LINQ got introduced with the help of extension methods so we just don't need this noise.
hblaub (6 months ago)
I don't like this! In C# we got extension methods already, so I find it better to tack something onto the interface later on. It's clear then to me that this extension came later and I can hide it with "using static" statements etc.
André Köhler (6 months ago)
I'm really looking forward to the nullable reference type feature in C# 8. NullReferenceException is probably one of the most frequent causes for C# programs crashing.
vinzer72frie (17 days ago)
Just use the ?: operator
Hong (5 months ago)
I start opting in Option type so I don't have to deal with null anymore.
hblaub (6 months ago)
I'm often get a method with several hundred lines and just a NullRef in the log file. Then, I will do a data flow analysis for every little shitty variable. Sometimes the methods got inlined and then it's even more fun!
Conner Wood (6 months ago)
57:50 - The ability to define a dynamic range on substring... yes, that is really nice, and really like the idea of havng index read from last to first via ^0, ^1
Brad Ford (5 months ago)
The obvious one (-) couldn't be used as explained. Also not a fan of ^... What would you use? I wonder if (!, as in 4..!2) would be a better choice?
Igor Popov (6 months ago)
If you know regex this is a bit confusing: ^ in regex means line START, but in C# it will mean index from the END... anyway, this doesn't mean I don't like the feature... it's just an observation...
Pheubel (6 months ago)
Dont you mean ^0..0 ?
Eduard Schäfer (6 months ago)
I like the development of C#
Julien Couvreur (6 months ago)
Find more information on the previews that were demo'ed at https://github.com/dotnet/csharplang/wiki
CodeBit (5 months ago)
Nice video, but it would be good if you recorded and uploaded this in 1080p at least. 720p videos is like 2010 level of quality.
Norbert Klar (4 months ago)
They're a 28B dollar company, but can't record their presentation in 1080p. Microsoft, you never change.
Juha Reinikainen (5 months ago)
You could say this video is not that sharp
borzak101 Me (5 months ago)
Well it's Microsoft. Suprised?
D: (6 months ago)
Would've been okay if they were recording in 720p.
Victor Tarnovskiy (6 months ago)
Mads is such a nice person. Probably this is reflected in the language itself :)
Carlos Alberto Flores (6 months ago)
I agree.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.