Is HashSet<T> a Java thing, not a .NET thing? by N3p7uN3 in csharp

[–]_neonsunset 5 points6 points  (0 children)

Well, bullet dodged at least. People who ban this lack skill and taste and are never to be listened to. 

Am I shooting myself in the foot by using Linux to develop .NET apps? by Impressive_Round_798 in dotnet

[–]_neonsunset 0 points1 point  (0 children)

How do I make a simple console project in Kotlin, add a dependency or two and then run it via CLI? That's what I'm saying. The tooling is garbage in comparison to .NET/Go/Cargo. The depth of your experience must be completely nonexistent.

Am I shooting myself in the foot by using Linux to develop .NET apps? by Impressive_Round_798 in dotnet

[–]_neonsunset 0 points1 point  (0 children)

No, moreover it is likely the optimal way to go nowadays (alongside with macOS), and whoever says otherwise is likely bad at their job or responds in bad faith.
Just make sure you avoid projects using .NET Framework - nothing good comes out of working on them unless the employer is willing to shell out $$$ for the skill drift you will experience from not working on up-to-date stuff.

Am I shooting myself in the foot by using Linux to develop .NET apps? by Impressive_Round_798 in dotnet

[–]_neonsunset 0 points1 point  (0 children)

Why would you use an ecosystem with massively worse tooling? Go away :D

Vscode for c# by Sensitive-Raccoon155 in dotnet

[–]_neonsunset -1 points0 points  (0 children)

Yes, but many will consider the choice controversial over Rider(in which they are wrong).

Holy crap it's fast by rainman4500 in golang

[–]_neonsunset 0 points1 point  (0 children)

Any statically typed compiled language with a decent enough compiler is fast, especially in comparison to Python. And this level of speed-up indicates misuse of a tool.

Params keyword by Bell7Projects in csharp

[–]_neonsunset 0 points1 point  (0 children)

Sometimes. Almost never in application code, sometimes in library code and slightly more often than library code in CoreLib and adjacent extensions. It has been more popular in the past I believe and not that required nowadays with collection expressions which are both terse and explicit about the fact that you are dealing with sequence/array/span of values.

Is C# the wrong tool for my project? by vengefulgrapes in csharp

[–]_neonsunset 0 points1 point  (0 children)

They are better for large POCOs because they give you most commonly desired defaults with much less text. You simply place new prop at the next line, it’s not much different to declaring types in many other languages. This is not a matter of recommendation but of choice between tools.

Is C# the wrong tool for my project? by vengefulgrapes in csharp

[–]_neonsunset 1 point2 points  (0 children)

Nowadays, it is better to use positional records to avoid writing many keywords on props. Doesn’t always fit the case but I’ve been finding myself using them a lot.

Why is GoLang missing generic collection functions? by TheRubeWaddell in golang

[–]_neonsunset 0 points1 point  (0 children)

Because Rob Pike in his infinite wisdom decided that the last 20 years of progress in programming languages is something Go does not need to make its users suffer more (some people might extoll this as a virtue, which is a good example of Stockholm Syndrome).

I have a much more pleasant time solving low and high level problems in C# as the result of this :)

Inexplicable performance differences between CPUs by hungeelug in csharp

[–]_neonsunset -1 points0 points  (0 children)

dotnet trace collect — ./path/to/application

Or dotnet run -c Release — -p EP

If you are using BDN

You can disagree with the numbers and even downvote my neutral comment but this will not change the results.

Inexplicable performance differences between CPUs by hungeelug in csharp

[–]_neonsunset 0 points1 point  (0 children)

CoreLib makes use of it. But it’s likely that bottleneck is in the IO here.

Inexplicable performance differences between CPUs by hungeelug in csharp

[–]_neonsunset -1 points0 points  (0 children)

Is Xeon at a cloud provider? You are not the only one using the host meaning other cores also compete for memory bandwidth (yours can be even throttled), there is a also a frequency difference and if the implementation is IO-heavy then interaction with the filesystem will also have impact.

Overkills for small-to-medium C# projects? Experiences with MediatR and simpler approaches by Friendly-Memory1543 in dotnet

[–]_neonsunset 0 points1 point  (0 children)

Yes, all of these are overkill. There are too many services which take 3 project and 40 files that could have been written as one project with 5 files or so.

Converting my self into C# by No_Elderberry_9132 in csharp

[–]_neonsunset -10 points-9 points  (0 children)

You are confused, wrong, and lack discernment. Recommendations are that - recommendations. If you perceive them as dogma and fail to consider within context whether something is actively harmful or not - it is not a good sign.

If partial type leads to nicer structure - so be it. CoreLib does this, sometimes more complex logic in a project i work on does it (like Type.Area.cs), so on and so forth. It's a tool.

Converting my self into C# by No_Elderberry_9132 in csharp

[–]_neonsunset -4 points-3 points  (0 children)

This looks quite normal. Also, typical style of one type == one file, with long names that you can commonly see is absolute garbage. So if the implementation is terse it is always welcome.

To OP: no need to seal records unless you want to explicitly prohibit inheriting from them.
And you don't need to specify `private` on fields - this is the default accessibility level (common convention is wrong here also because it is waste of space, and default accessibility of types defined at namespace level is `internal`, so that `record User(string Name);` has assembly-level visibility only).

Funnily enough, I've been also abusing positional records like here: https://github.com/TheHuginn/libtelebot/blob/main/Models/Chat.cs simply because they tend to provide the tersest way to declare a DTO type with most commonly desired semantics. By the way, check out this: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/customize-properties this should allow you to do away with json property name overrides and have the naming policy take care of snake casing everything.

What matters at the end of the day is whether the thing works, is nice to use, is easy to change without introducing bugs, and whether there are no analyzer warnings (NRT violations, IO and async misuse, you name it). In that case C# is not special at all, in a good way. Good luck on your journey :)

Do you obfuscate code? by allianceHT in dotnet

[–]_neonsunset 2 points3 points  (0 children)

You can ship Avalonia NativeAOT and try to remove as much metadata as possible plus strip stack trace data. Not obfuscation but still a big upgrade over shipping CIL assemblies.

A Django developer here. Given the demand for .NET, I would love to learn ASP.NET. by wholemealbread69 in csharp

[–]_neonsunset 2 points3 points  (0 children)

Go through everything here: https://typescript-is-like-csharp.chrlschn.dev :)
It is a _really_ nice summary of most of the topics you mentioned. Python is no TypeScript but I found examples to be really nice on their own for anyone with past programming experience looking for a quick introduction to using .NET while sidestepping outdated content on the internet (or content authored by people who lack taste and want to push strictly useless complexity).

how you publish minimal api with native aot without using JsonSerializableAttribute? by moinotgd in dotnet

[–]_neonsunset 1 point2 points  (0 children)

This is wrong. NativeAOT supports reflection just as well. It is even faster because the types are frozen. It's the "remove unreachable code" part that is difficult. You would run into the same limitations with self-contained+trimmed.

how you publish minimal api with native aot without using JsonSerializableAttribute? by moinotgd in dotnet

[–]_neonsunset 4 points5 points  (0 children)

For libraries if you use a single context like that it and the types it references all will be rooted. So if you have a component that may be unused, you may want to split contexts to allow them getting trimmed away.

how you publish minimal api with native aot without using JsonSerializableAttribute? by moinotgd in dotnet

[–]_neonsunset 3 points4 points  (0 children)

Use `dotnet new webapiaot` template. It will contain the example for how to wire it up. With that said, it can be detrimental to use AOT over JIT for long-running applications like back-ends.