Earlier quoted context omitted.
Allegedly there's an upgrade path from .NET 4.8 to .NET 5.
The upgrade path is massive rewrites, something most business are wary of. For good reasons. MS really made a grave mistake by coupling the evolution of the C# language to the .NET version. This means all projects on the .NET framework is now also stuck with an obsolete language version for no good reason. It is becoming a a lot less fun to be a C# developer because you more often will have to work with obsolete tool…
C# 9 top-level programs and target-typed expressions
31–40 of 188 posts
Re: C# 9 top-level programs and target-typed expressions
#32I think that C# is underrated. Although TypeScript is my default language choice for most programming, C# / .NET is my choice for cases where: - high performance is important - or interop with native libraries is required (because C#'s DllImport attribute makes that super simple) Another benefit is that C# is syntactically similar to TypeScript (they were both designed by Anders Hejlsberg after all), so switching bet…
C# is my goto for Windows, for sure. Is the native interop good in Linux as well? I've never even considered anything like that, would probably gravitate to C++ since that's what I'm familiar with but would seriously consider Go or Java in non-Windows situations.
Give .NET 5 on Linux a try, you'll be surprised!
For me, the work this team has been doing is the example of the positive "change" Microsoft has brought to the open source space. A stellar language with great infrastructure.
Re: C# 9 top-level programs and target-typed expressions
#33I think that C# is underrated. Although TypeScript is my default language choice for most programming, C# / .NET is my choice for cases where: - high performance is important - or interop with native libraries is required (because C#'s DllImport attribute makes that super simple) Another benefit is that C# is syntactically similar to TypeScript (they were both designed by Anders Hejlsberg after all), so switching bet…
Re: C# 9 top-level programs and target-typed expressions
#34I think that C# is underrated. Although TypeScript is my default language choice for most programming, C# / .NET is my choice for cases where: - high performance is important - or interop with native libraries is required (because C#'s DllImport attribute makes that super simple) Another benefit is that C# is syntactically similar to TypeScript (they were both designed by Anders Hejlsberg after all), so switching bet…
A bit of a tangent but is it possible yet to compile C# to native code easily (like calling a normal compiler on the command-line)? Last time I checked I needed to jump through a bunch of hoops through Visual Studio, and create some XML or other nonsense. I don't get why they've made it so hard compared to just compiling managed code.
Re: C# 9 top-level programs and target-typed expressions
#35To me, the benefit of "Target-typed new expressions" is more with bringing consistency to class-scope member declarations and method-scope member declarations, so these two can look the same, and a programmer only has to read one way of declaring new members in C#: public class MyClass { private readonly MyDependency _myDependency = new(); public void MyMethodThatDoesWork() { MyVariable variable = new(); } } As oppos…
I can't see var going anywhere, many times you aren't directly creating a new object, but getting a generated object from something ( like linq) which tends to have more complicated type signatures.
Sure, in your own IDE, and reading the code you just wrote, no problem. But when doing code reviews and jumping all over, I want to see the type right there. Nothing more frustrating than reviewing a PR with var's all over. This isn't even up for debate anymore... No more var!
It is frustrating to still see var as the recommended way by Microsoft... You can even put in a rule to format the document and add explicit types as well on save. So complicated type signatures for linq aren't a problem!
Re: C# 9 top-level programs and target-typed expressions
#36Unfortunately the new tricks can't be used when the codebase is still stuck on .net framework :(
There are many paths out of hell. Check out the windows compatibility pack for all things active directory, WCF & System.Drawing: https://docs.microsoft.com/en-us/dotnet/core/porting/windows... Winforms is probably a no-go on migration, but you should definitely check out Blazor if you want to develop any new business apps. We have constructed some incredibly complex business dashboards using this framework and cant…
WPF is probably dead though.
Re: C# 9 top-level programs and target-typed expressions
#37I have been programming with c# since 2000 i think. But I do not like where the languages is going. It is becoming way to loose in a sense and it seems that it wants more than it should. If you want to do functional programming, pick a fp language. If you want to do dynamic typed programming pick a dp language. Sure you can mix some things in, but c# is becoming way to scattered imo. And it's not pretty i think.
Re: C# 9 top-level programs and target-typed expressions
#38I have been programming with c# since 2000 i think. But I do not like where the languages is going. It is becoming way to loose in a sense and it seems that it wants more than it should. If you want to do functional programming, pick a fp language. If you want to do dynamic typed programming pick a dp language. Sure you can mix some things in, but c# is becoming way to scattered imo. And it's not pretty i think.
Re: C# 9 top-level programs and target-typed expressions
#39Earlier quoted context omitted.
I can't see var going anywhere, many times you aren't directly creating a new object, but getting a generated object from something ( like linq) which tends to have more complicated type signatures.
Agreed that `var` isn't going anywhere, but this feature's best use case is with complex generics/enumerables and things like anonymous tuple types. For example: // old: var x = new List > { new KeyValuePair ("a", 1), new KeyValuePair ("b", 2) }; // new var x = new List > { new("a", 1), new("b", 2) };
Re: C# 9 top-level programs and target-typed expressions
#40Earlier quoted context omitted.
There are many paths out of hell. Check out the windows compatibility pack for all things active directory, WCF & System.Drawing: https://docs.microsoft.com/en-us/dotnet/core/porting/windows... Winforms is probably a no-go on migration, but you should definitely check out Blazor if you want to develop any new business apps. We have constructed some incredibly complex business dashboards using this framework and cant…
I'm pretty sure WinForms is being migrated. I've built dotnet 5 WinForms apps, anyway. At least on Windows - I wouldn't bet on a Linux Gtk/Qt port any time soon. WPF is probably dead though.