Mads is such a nice person. Probably this is reflected in the language itself :)
@focl20036 жыл бұрын
I agree.
@andrekohler57926 жыл бұрын
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.
@hblaub6 жыл бұрын
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!
@sowenzhang6 жыл бұрын
I start opting in Option type so I don't have to deal with null anymore.
@vinzer72frie6 жыл бұрын
Just use the ?: operator
@llothar685 жыл бұрын
Fire your coders and hire better ones. As a C++ programmer i never understood why this is a problem.
@conner_wood6 жыл бұрын
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
@Pheubel6 жыл бұрын
Dont you mean ^0..0 ?
@LittleBobbyHasTables6 жыл бұрын
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...
@bradford86116 жыл бұрын
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?
@perahoky6 жыл бұрын
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
@ryan.crosby6 жыл бұрын
That return switch syntax is so cool!
@Neme1126 жыл бұрын
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 { ... })`
@uncommonbg6 жыл бұрын
Yes, Kotlin does the same thing with "when" expression and I love it.
@marna_li6 жыл бұрын
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!
@Speedow5 жыл бұрын
I just learned from this video that I can use tuples in my value assigment constructors in a lambda expression instead of writing a block. amazing, off to refactor all my classes...
@eduard.schaefer6 жыл бұрын
I like the development of C#
@mamunurrashid56526 жыл бұрын
C# is awesome!!!
@hl2mukkel6 жыл бұрын
1:00 "This is becoming traditional, C# has a future and we're going to talk about it" _audience laughs_
@superstringcheese6 жыл бұрын
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.
@Grimlock19796 жыл бұрын
I have been waiting for that switch expression syntax for years!
@mike-e-angelo6 жыл бұрын
What an excellent session. Very appropriate for an excellent language. :)
@tecgoblin6 жыл бұрын
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# :)
@Macellaio946 жыл бұрын
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
@synetic707x6 жыл бұрын
Love C#, C++ and Rust :)
@dppage6 жыл бұрын
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.
@stuartross56866 жыл бұрын
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 $
@kingarthurthethirdthst38046 жыл бұрын
Whoaaaa, new keywords! C# was certainly lacking those.
@TheNefastor6 жыл бұрын
I love their energy :-)
@harrodharrod52396 жыл бұрын
shouldn't the last be ^0? Kinda coutnerintuitive indexing from 0, but from 1 when coutning backwards
@denys-p6 жыл бұрын
How about discriminated unions and pattern matching that will have error/warning in non-exhaustive cases set?
@wertrager6 жыл бұрын
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. ceylon-lang.org/documentation/1.3/spec/html_single/#unionandintersectiontypes
@robertmcalery93236 жыл бұрын
I'm sure they're looking into it. They just need more time to see how the F# implementation can be implemented in C#.
@lrhlpz6 жыл бұрын
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#.
@denys-p6 жыл бұрын
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.
@Vindignatio6 жыл бұрын
@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.
@bradford86116 жыл бұрын
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).
@WhiteDragon1036 жыл бұрын
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.
@Luke-me9qe6 жыл бұрын
So apparently you bringing back pointer algorithm in a way, just a little safer?
@ВалентинТ-х6ц6 жыл бұрын
13:29 How did he edit GrabBag.csproj file without unloading it? I have no such item in popup menu. Some kind of extension?
@bobbastian7606 жыл бұрын
guys AT LEAST 1080, better 4K - so we can actually read the code!
@wertrager6 жыл бұрын
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)
@robertmcalery93236 жыл бұрын
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.
@lrhlpz6 жыл бұрын
C# is gaining some functional things, but it is not a functional language. F# is and will be better as FL.
@hamesjetfield06 жыл бұрын
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.
@TheMonk726 жыл бұрын
Oh, did you just implement const parameters in C#?
@somebody_on_the_internetz6 жыл бұрын
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.
@vitaliiyarema6 жыл бұрын
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!!!???
@theMagos6 жыл бұрын
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"?
@IsmeGenius6 жыл бұрын
You want non-nullabe by default, preferrebly with no noise
@brunoccs6 жыл бұрын
What's that console he's using?
@metaorior6 жыл бұрын
would i have to download 3.5 gb
@Void-uj7jd6 жыл бұрын
No it will magically fly through the air.
@WorstDeveloper6 жыл бұрын
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.
@user-zu1ix3yq2w6 жыл бұрын
Would've been okay if they were recording in 720p.
@borzak1016 жыл бұрын
Well it's Microsoft. Suprised?
@juanrein6 жыл бұрын
You could say this video is not that sharp
@klarnorbert6 жыл бұрын
They're a 28B dollar company, but can't record their presentation in 1080p. Microsoft, you never change.
@Nolanyoyo6 жыл бұрын
Whats it do, dont have a hour to find out
@marcosbeni58756 жыл бұрын
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.
@harrodharrod52396 жыл бұрын
I think it was fairly readable up until they started doing the recursive patterns thingy with it.
@wisnu77346 жыл бұрын
C# is rock....i like it...
@binaryalgorithm6 жыл бұрын
I did a lot of C#, then recently took a Java position. Not even close on language features, ease of use, and the IDE...
@fr3fou6 жыл бұрын
binaryalgorithm which way? C# > Java or Java > C#? Your comment can be taken both ways
@braed62026 жыл бұрын
Which isn't close?
@vangrails6 жыл бұрын
Your words are very ambiguous.
@MikeSheen19726 жыл бұрын
Then he/she is obviously in the Java camp.
@StevenAkinyemi6 жыл бұрын
Duh, (s)he meant Java isn't close on language features, ease of use, ...
@TheNefastor6 жыл бұрын
That range literal at 58:28 is coming straight from VHDL 😁
@suhuy20086 жыл бұрын
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 { bool Equal (T a, T b) => ! DoNotEqual(a, b,); bool DoNotEqual(Ta, Tb) => ! Equal(a, b); }
@wertrager6 жыл бұрын
You can't do that, which of those would be the default?
@wertrager6 жыл бұрын
You can't do that, which of those would be the default?
@wertrager6 жыл бұрын
You can't do that, which of those would be the default? Typeclasses are something else, they generate constraints, not types.
@wertrager6 жыл бұрын
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.
@wertrager6 жыл бұрын
You can't do that, which of those would be the default? Typeclasses are something else, they generate constraints and not types.
@petter90786 жыл бұрын
Wish there was a TLDR of this stuff. Or if it was chopped so you dont have to watch it all in one sitting.
"ref, readonly, in" sound like C#'s version of const correctness that's present in C++. *gasp*
@sergekg2kg8446 жыл бұрын
Please add possibility use references on properties
@chidieberejoshua53146 жыл бұрын
What's the future of VB.NET?
@TaoriUTS6 жыл бұрын
was hoping for a demo of concept :(
@desi-musk6 жыл бұрын
I'm a JavaScript Developer and I am lost here...
@dumky6 жыл бұрын
Find more information on the previews that were demo'ed at github.com/dotnet/csharplang/wiki
@justnothing70806 жыл бұрын
return (middleName ?? "").Length;//this is how it should be done.
@WhiteDragon1036 жыл бұрын
Don't you mean return middleName?.Length ?? 0
@onursahin79706 жыл бұрын
all these new things with ref sounds like const refences in c++
@IsmeGenius6 жыл бұрын
they are more like references in rust, cause they are safe
@TheoWerewolf6 жыл бұрын
Dear God.. that new return/switch thing is hideous. Was someone trying to win an obfuscated code contest? Less clearly isn't always more.
@onlyice6 жыл бұрын
Yeah... I have to agree... We can't let that happen.
@hblaub6 жыл бұрын
Recursive patterns inside the "property matching"?! ..... I would like the power to do it but this syntax will become unreadable in a team with several developers and a huge legacy code base.
@tecgoblin6 жыл бұрын
I love the new return switch - like the way it was before the introduced into it deconstruction. But I'm not fond of recursive patterns. To keep it readable you need to name your local variables full text (firstName, lastName etc), so in the end you gain like… 2 characters? And if you abuse it you end up with this unreadable example.
@robertmcalery45746 жыл бұрын
C# is looking more and more like C++ with each new release.
@JustinMinnaar6 жыл бұрын
I agree, it's going to make reading for a nightmare.
@andrekohler57926 жыл бұрын
Why do we need default implementations in interfaces when we already have abstract classes for this? This sounds like language bloat to me.
@wertrager6 жыл бұрын
So that you can evolve your interfaces through time as requirements of your system change. This will save architects a ton of time, as they will not need to introduce breaking changes.
Also because Classes can only inherit from one abstract base. Where they can inherit from multiple Interfaces.
@hblaub6 жыл бұрын
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.
@hblaub6 жыл бұрын
In Java 8, the JRE got Streams and a new functional approach - very useful but sadly not defined on Collection 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.
@elderofzion6 жыл бұрын
just chill out with the new versions... or you're gonna turn into java
@vp47446 жыл бұрын
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?
@braed62026 жыл бұрын
Uh, because C++ takes twice as long to write, is harder to learn and isn't safe?
@vp47446 жыл бұрын
Yes, C++ is not for every programmer. Only the good ones would benefit.
@braed62026 жыл бұрын
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.
@vp47446 жыл бұрын
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.
@greenscreen5876 жыл бұрын
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...
@bradford86116 жыл бұрын
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.
@greenscreen5876 жыл бұрын
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.
@rockydirt6 жыл бұрын
lol... I don't understand why they troll JavaScript.
@themeeman6 жыл бұрын
cause it sucks
@MikeSheen19726 жыл бұрын
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.
@prabhathamaradasa12636 жыл бұрын
Little stolen from python...:)
@nightquest526 жыл бұрын
Vars are plague of every coding language. So much effort to write INT instead of VAR.