Where’s C# headed? - Mads Torgersen - NDC Copenhagen 2022

  Рет қаралды 30,017

NDC Conferences

NDC Conferences

Күн бұрын

Пікірлер: 53
@JohnWilliams-gy5yc
@JohnWilliams-gy5yc 2 жыл бұрын
The auto-trimed indented unescaped string is very creative. This pattern should be in every other language already.
@desertfish74
@desertfish74 2 жыл бұрын
kotlin has trimMargin() and trimIndent() to do this.
@Alex-dj1rf
@Alex-dj1rf 2 жыл бұрын
Java actually got it first :)
@frankhaugen
@frankhaugen 2 жыл бұрын
My nuget with a HUGE amount of generated extension methods is now obsolete :-(
@xionwin5514
@xionwin5514 2 жыл бұрын
OHHHH, very exciting features, The INumber related is what I have been looking forward to for many years.
@nmarcel
@nmarcel 2 жыл бұрын
I love the Static members in Interface features. However I think that math focused example of application is way less required and useful than using it for common applications such as to centralize metadata like entity model info or behavior like business rules or so (i.e. require less or no extension methods or reflection).
@ryan.crosby
@ryan.crosby 2 жыл бұрын
Agreed, generic math is very cool (great for the BCL to include), but for end developers there are a lot of other opportunities to use static members on generics via interface constraints. Factories are one usecase (as mentioned). Personally I have usecases in EF Core where an interface returns a different Func depending on concrete type, which will in turn generate different SQL queries when EF gets to it. In this way I can significantly reduce the amount of duplicate code in the codebase by writing generic extension methods over an interface which in turn define a single LINQ query that organically changes based on which type is used. I already do this with reflection... I basically define the method on the interface as a normal interface method, but in the implementation I make sure to never touch the "this" reference. Then I use Delegate.CreateDelegate to create the delegate manually with a "null" this reference, allowing the method to be called as if it were a static method (without instantiating the object), even though it's really an instance method. Once I get C# 11, I can swap all of that code right out and it'll be beautiful ✨
@modernkennnern
@modernkennnern 2 жыл бұрын
I'm still stuck in .Net Framework land (I honestly hope Microsoft just fully ends support for it soon, so we _have_ to convert our projects, but that won't happen anytime soon unfortunately.. (Not that we'd swap even if they did >_>). Thankfully almost every feature added to C# since 8 (The first version of C# not officially suppported in Framework) does work. Practically only the interface-specific ones don't. That's a long pointless tangent. All to say; I had a scenario last week where an static abstract interface member would've been useful, but I couldn't use it, so I had to resort to instantiating each type just to get metadata, which feels so wrong.
@phizc
@phizc 2 жыл бұрын
While it's true most people won't need to make types that implement INumber, it's an easy example to show what's possible. Generic math has already been used to trim a lot of duplicate code in the BCL. E.g. LINQ's Sum method.
@ewdlop1
@ewdlop1 2 жыл бұрын
it is just an example
@Dmitry-Moiseenko
@Dmitry-Moiseenko 2 жыл бұрын
Mads, thank you for a great talk! Looking forward to use these great new language features when C# 11 and .NET 7 will be released.
@mcmaddie
@mcmaddie 2 жыл бұрын
I don't even use C# yet here I am watching/listening this...
@aguluman
@aguluman Жыл бұрын
How about now?
@Jankoekepannekoek
@Jankoekepannekoek 2 жыл бұрын
Oh cool, so C# interfaces can now be used as type classes, nice!
@seanvogel8067
@seanvogel8067 2 жыл бұрын
“That was a joke.” 😂 It was funny even. 😀
@userfortytwo
@userfortytwo 2 жыл бұрын
" " " " " " " " " Nice presentation, thanks! " " " " " " " " " 🙂
@KieranDevvs
@KieranDevvs 2 жыл бұрын
You seem to be missing some interpolation. $$$$$$$$$$$$$"""""""""""""""""""""""""""""""""""""""""{{{{{{{{{{{{{{{}}}}}}}}}}}}}}}}}}}}}{{}{}{{{{{{}}}}}}}}}{{{{{{}}}}}}""""""""""""""""""""""""""""""""""""""""""""""
@RobertGeorgeAtkinson
@RobertGeorgeAtkinson 2 жыл бұрын
Given all this new cool stuff, I'm a little surprised to see just INumber and not IRing, IField, etc. Was that considered?
@santiagoflorez6865
@santiagoflorez6865 2 жыл бұрын
What a video bro! Can't thank you enough! Thank you so much you made life so much easier!
@def1nt
@def1nt Жыл бұрын
I wanted this new string literal format for so long, so I could just slap an entire html page into my string. Also good for sql.
@lancemarchetti8673
@lancemarchetti8673 2 жыл бұрын
YaY! From Cape Town South Africa...great 😃...sea the sharp canon !!
@neroamayo6345
@neroamayo6345 2 жыл бұрын
Why not instead of public required string FirstName {get; init} just have something like public string FirstName {get; required;} . it's more clean and required implies it should be initialized like init. am I missing something here?
@ryanlashkevich9615
@ryanlashkevich9615 2 жыл бұрын
Yeah, number of dollar signs solves a lot of problems nowadays 😏
@daitedve1984
@daitedve1984 2 жыл бұрын
Too thin joke for C# team. ;]
@sps014
@sps014 2 жыл бұрын
Discriminated Unions, Struct finalizers Move semantics, In C# please 🥺
@IshCaudron
@IshCaudron 2 жыл бұрын
Why?
@martinprohn2433
@martinprohn2433 2 жыл бұрын
I wanted to ask the same question: Why? If you need all that, why not use C++/CLI directly for that. But speaking of which, C++/CLI could support C++20 things like std::thread and stuff like C++ lambdas, which is about supported yet. It makes writing .net in C++ much harder not having these syntactic sugars. On the other hand, it is s great way to really understand what happens in C# under the hood, if you have to write it verbosely in C++. (Sorry, I think I drifted a little from the actual topic.)
@sps014
@sps014 2 жыл бұрын
@@martinprohn2433 c++/cli is windows only
@martinprohn2433
@martinprohn2433 2 жыл бұрын
@@sps014 You are probably right, I didn't thought of that. But I'm still not sure, that putting all those C++ concepts into C# is a good idea. Maybe instead it would be a better idea to improve C++/CLI to work on different platforms. Or create a possibility to create pure .net assemblies with C++ instead of mixed assemblies, like with C++/CLI.
@sps014
@sps014 2 жыл бұрын
@@martinprohn2433 it would be great if these features are available and are not enforced on existing users (so their workflow is not hampered) and yet benefiting Low level developers in achieving high end performance goals in C# itself rather than utilising rust or C++ code.
@denischudinov2379
@denischudinov2379 2 жыл бұрын
I wander why to not introduce backticks ` ` instead of multiple quotes " " ? Like JavaScript does.
@fabioluizalvaresosti7115
@fabioluizalvaresosti7115 Жыл бұрын
Because of languages that have like portuguese that have backticks like in à
@denischudinov2379
@denischudinov2379 Жыл бұрын
​@@fabioluizalvaresosti7115 But this code works perfectly in JS with backticks: var a = `à`; Did I get you wrong?
@alirezanet
@alirezanet 2 жыл бұрын
Amazing presentation and features 👏👏
@b33j4y
@b33j4y 2 жыл бұрын
32:00 - Why can't the compiler determine the type of T? (It's not because of a preview version - current VS2022 behaves the same)
@FlameRat_YehLon
@FlameRat_YehLon 2 жыл бұрын
Checked a bit of document and my guess is that because double[] isn't inheriting or implementing Span there's no way for the compiler to know which T to use. Not sure if it's possible to figure out generic types using implicit conversion (posible means that there's mathematical proof that it can always work), but it's reasonable that it isn't working yet.
@b33j4y
@b33j4y 2 жыл бұрын
@@FlameRat_YehLon True, they are different types, but I've passed double[] to methods that take Span lots of times before. Don't think there was anything special about them
@FlameRat_YehLon
@FlameRat_YehLon 2 жыл бұрын
@@b33j4y The only reason you can pass T[] to Span is that there's an implicit conversion being implemented. And this doesn't say anything about if you don't specify the T, would the compiler still be able to know which T it is.
@spoonfuloftactic
@spoonfuloftactic 2 жыл бұрын
I'm smelling a new version of Pegasus.
@jaiderariza1292
@jaiderariza1292 Жыл бұрын
the new namespace System.Numerics :)
@otilionunezmaciel8951
@otilionunezmaciel8951 2 жыл бұрын
everytNice tutorialng, I really would pay for a webclass
@larsthomasdenstad9082
@larsthomasdenstad9082 2 жыл бұрын
Dude, you're Norwegian enough for me. :)
@dennisfruhauff6295
@dennisfruhauff6295 2 жыл бұрын
I struggle to see the obvious benefit I'd have with static interface members for factories... can anybody give me a simple example?
@ciberman
@ciberman 2 жыл бұрын
If you don't see the benefits it's because you never had a full tree hierarchy with 20+ classes and 20+ factories for each one of those classes 😂
@bigbtripathi
@bigbtripathi 2 жыл бұрын
There are new age languages like Rust, Go, Carbon and Zig etc which are much faster. Even Python, JavaScript, Java are also working to make the language/framework faster. Seems everybody working towards increasing performance. Can C# be made faster ?
@Mr7Shane
@Mr7Shane 2 жыл бұрын
People don't use languages based on how fast their are? Nobody uses rust, go, zig. C# is already 100x faster then python and yet python is more popular.
@MasterOfMisc
@MasterOfMisc 2 жыл бұрын
In .NET 7, you can compile your app with AOT (ahead of time). You end up with an app that is self-contained and that has been compiled to native code. The app will start up very quickly and use less memory. It would be nice if benchmarking sites like techempower would use test the AOT version of C# as well as the normal JIT (just in time) version to see how it stacks up against C++, GO and Rust
@dlg75
@dlg75 2 жыл бұрын
What happens when your string literal starts or ends with a double quote? Can you still win?
@KalleJillheden
@KalleJillheden 2 жыл бұрын
You can always win
@هعیروزگار-ذ9ع
@هعیروزگار-ذ9ع 2 жыл бұрын
😂🙏😀💥
@daitedve1984
@daitedve1984 2 жыл бұрын
C# is rolling down to cloaca. Useless, half-baked, stupidly implemented features completely stop me from watching C# progress - I stopped at C# 8.0 and don't want to see your(Torgersen) work anymore.
@halvarf
@halvarf 2 жыл бұрын
Make a good video or blog post about what you mean and you will surely get a lot of attention. Ranting in a KZbin comment and just claiming instead of showing is pointless. From your comment, you could just be a bad old grumpy programmer unwilling to learn anything new (there are definitely a few of those in the C# community).
The functional journey of C# - Mads Torgersen - NDC Copenhagen 2022
1:01:28
What's next in C# - Mads Torgersen - NDC Sydney 2024
1:03:21
NDC Conferences
Рет қаралды 9 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 3,5 МЛН
When u fight over the armrest
00:41
Adam W
Рет қаралды 31 МЛН
Writing Allocation Free Code in C# - Matt Ellis
1:00:15
NDC Conferences
Рет қаралды 71 М.
Don't throw exceptions in C#. Do this instead
18:13
Nick Chapsas
Рет қаралды 262 М.
Change your habits: Modern techniques for modern C# - Bill Wagner
55:46
NDC Conferences
Рет қаралды 251 М.
F# for Performance-Critical Code, by Matthew Crews
1:03:23
JetBrains
Рет қаралды 12 М.
Why Didn't He Get the Job? Let's Find Out! // Code Review
27:25
The Cherno
Рет қаралды 148 М.
Fractal Architecture - Mark Seemann - NDC Copenhagen 2022
59:42
NDC Conferences
Рет қаралды 8 М.
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 643 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 3,5 МЛН