What is an example of a really good codebase written in modern C#? There are quite a few appealing things about the language, but I'm having trouble shaking the feeling that it's kind of like Java. I know both languages have evolved a lot, but some codebases might get stuck in some old patterns.
Welcome to C# 9.0
91–100 of 196 posts
Re: Welcome to C# 9.0
#92I still think C# is one of, if not the best of designed languages exist. Even it moves in much smaller steps than it was before I think it's for good. I left .NET land at 6.0 and .NET 4.x versions mostly because of Windows eco-system (small open source community, almost no alternatives to out of the MS things, bad linux support). Since that I've been working with Java, Swift,JS, Python, Golang and I still think that…
To me C# is the second best designed language, the first being IMHO Kotlin. I'm very interested in what you think would make C# more well designed than the latter :}
Code examples have a lot of what looks like lambda callback hell and I find it hard to read but again, I might just need more practice.
Re: Welcome to C# 9.0
#93Positional records are a terrible idea, one of the best things about C# is readability var (f, l) = person; is so much worse than var (f, l) = (person.FirstName, person.LastName); I don't want to have to refer to documentation or class implementation to understand what a destructuring expression does.
var (f, l) = SomeMethodReturningAPerson();
than: var person = SomeMethodReturningAPerson();
var (f, l) = (person.FirstName, person.LastName);
or: foreach(var (f, l) in enumerationOfPersons) { ... }
compared to: foreach(var person in enumerationOfPersons)
{
var (f, l) = (person.FirstName, person.LastName);
...
}
When you know what you want to compute, but have to throw in extra temporary variables it becomes tedious and error prone. Cut straight to the thing you want (the names themselves in this case), eliminate middlemen.Re: Welcome to C# 9.0
#94What is the winforms simple (ie, drag and drop form designer, click through for code) current windows development recommendation. I've seriously lost all track of how to just get up and going. I've tried UWP/WPF etc - they felt like a bit of nightmare for quick and go, but the tooling now seems to have dropped winforms? I couldn't get the form designer to actually show up even on a WinForms project?
It seems to be alive and well: https://devblogs.microsoft.com/dotnet/windows-forms-designer... Sadly only in Visual Studio and not Visual Studio Code. And yes, there is probably no one who used winforms that wouldn't be shocked by WPFs steep learning curve.
I'm mostly developing server on linux so I'm not enough of designer to even begin to wrap my head around XAML / MVVM / WPF / UPF (?) new world order on windows.
SO glad they are going to allow for some simpler approaches - and no, I don't want to build skinnable apps for business - I actually LIKED that all the apps looked / worked basically the same in the old world even though that's no longer cool.
We now have some silverlight apps, some IE only apps, some WPF / UPF apps. But the old winforms apps still get lots of use and still work. I've found the "better" WPF / UPF stuff to kind of lag and stutter even sometimes - I've got no idea why. The winforms apps on new machines are snappy.
Re: Welcome to C# 9.0
#95Earlier quoted context omitted.
It's by far my favorite general purpose language. Works well everywhere, and the best tools around.
> Works well everywhere Perhaps it's gotten better - TBH I haven't checked in years - but it used to be a horrible bug ridden mess for doing things aimed at Linux (i.e. via mono).
Re: Welcome to C# 9.0
#96How does the .NET ecosystem fare these days compared to Java's? Whatever the differences between the languages, on the surface of things it looks like one must be insane not to use Java: https://projects.apache.org/projects.html?language
Apache is somewhat Java centric. I wouldn't use that as a measure of a language's ecosystem. For example, JavaScript has an enormous ecosystem but only 17 Apache projects.
Re: Welcome to C# 9.0
#97Relational/Logical patterns are going to revolutionize our ability to make high-level business logic even more accessible to non-wizards. The switch expressions introduced in 8.0 were already very nice for building out our complex in-line mapping code. This takes things to a completely different dimension.
I will say that I am a little confused on the role of Record vs Class vs Struct. Do we not already have the ability to declare immutable value types with structs? How does the Record improve on the struct which already exists in the language?
> Structs override this to have “value-based equality”, comparing each field of the struct by calling Equals on them recursively. Records do the same.
Seems like we might be splitting hairs here?
Re: Welcome to C# 9.0
#98Earlier quoted context omitted.
Deep code profiling of the JVM is still a lot better than Linux .NET Core. I still like C# though.
Probably, haven't tried really on .Net but Java is awesome. Another point where it is really hard to get people to actually understand the magnitude of the difference is in IDE support, what exists and what you get out of the box. I mostly enjoy programming in .Net Core a lot but there are times when the difference becomes extremely visible.
Re: Welcome to C# 9.0
#99What is the winforms simple (ie, drag and drop form designer, click through for code) current windows development recommendation. I've seriously lost all track of how to just get up and going. I've tried UWP/WPF etc - they felt like a bit of nightmare for quick and go, but the tooling now seems to have dropped winforms? I couldn't get the form designer to actually show up even on a WinForms project?
You can write Winforms like code in WPF and get better layout capabilities. If you stay away from MVVM then WPF is pretty straightforward.
Re: Welcome to C# 9.0
#100Earlier quoted context omitted.
> Works well everywhere Perhaps it's gotten better - TBH I haven't checked in years - but it used to be a horrible bug ridden mess for doing things aimed at Linux (i.e. via mono).
Yeah I remember the days of subtle mono bugs and segfaults, but the new(-ish, its been out for years) .NET Core brings official support to linux. ASP.NET Core is definitely a solid platform for web apps on Linux now too.
Even the newly announced MAUI is only "community supported" on linux.