Remix.run Logo
▲ SurajMishra 3 hours ago

For the features that overlap between golang and .Net, can someone please let me know why people choose .Net over golang for non legacy systems? As far as my limited knowledge goes, go is much more efficient in syntax and memory.

▲fabian2k an hour ago | parent | next [-]

The languages are very different. C# has much more powerful abstractions and is a much larger language in general. That is both an advantage and a disadvantage. Modern C# is also very fast, I wouldn't bet on Go winning that comparison.

My experience with Go is a while back, before it got generics. While I liked the overall idea of a language with little syntax and a focus on simplicity, I didn't really like Go in the end. It was a weird mix of too low-level and high level code. It exposed low level details that I don't need to think about in C#, and it is missing convenient abstractions like LINQ.

Personally, I like async/await in C# more than Go concurrency. I know this is heretical here, but I don't care about function coloring or any of the abstract advantages of other concurrency approaches. Async/Await in C# works for me (in non-legacy code) and is easy to understand.

▲fodkodrasz 41 minutes ago | parent [-]

the main problem with the .net async/await is the immediate execution of a call returning a Task, without control over where it may execute. F#'s asnyc was way saner and easier to understand in my opinion.

I'd beg to differ on the easy to understand... last time i worked with this stuff like ConfigureAwait only has cargo cults and no real good explanation, and wasn't covered in any recent version of eg. CLR via C#... Distributed tracing and thread management were totally bitten by async, also the way iterators and LINQ were broken... that was when I got off the train, as it broke the best abstractions for line of business code so that instead of designing an IO pipeline lazy developers could simple put Task.Run around blocking IO calls at the bottom of the codebas, and ... yeah, we are back at function coloring.

This brings me to: I winder for what kind of apps did you find it a delight, because for extensive data wrangling leveraging multiple calls it was a pain.

▲fabian2k 36 minutes ago | parent [-]

You don't need ConfigureAwait() at all in modern C# (unless you're writing desktop UI code, I don't know enough about that to comment there). In a modern ASP.NET Core web application you don't care about which thread your Task executes, there is no synchronization context at all.

I'm using C# for the backend of a web application, not legacy but .NET Core from the start.

▲fodkodrasz 20 minutes ago | parent [-]

Sometimes you do care where it executes, and then it starts to become a problem ;).

Something which was as easy as an IO call in the middle of a function running on a thread pool becomes a PITA if the IO call is cleverly async-ized (by wrapping the original sync IO method into a Task.Run(), but actually this is the better case!) ad then removed from the public API... (cannot recall the exact library, but it was a pain, as it was some core stuff, maybe vendored by MS themselves)

Also back then it caused us loosing correlation IDs as those were thread locals in traditional pre-async ASP.Net Core (think version 0.9-2.0 when I worked on that part, then up until core 4 and the async mania continuos broke readable calculation code in LINQ, TPL based performant data pipelines, etc...) and with async execution started to migrate between threads... If you needed high performance you already used threads, because it was not a classic web application, but a specialized optimization algorithm with a web api... and if you need more than CRUD, and use all the cores (and SIMD) to squeeze out all performance you have, you hit these problems right away. These all could be solved, but it actually broke stuff, a lot of stuff, as developers jumped on the fad, and it their sync code was turned into a .ConfigureAwait(false /* Microsoft blogs talk a lot about it without a clear explanation, so every cool kid does this */).GetAwaiter().GetResult()... then you some of your threaded code silently broken if you dare used Thread Locals... Faded memories, but that was when they f'ed up the C# language.

▲fabian2k 16 minutes ago | parent [-]

That's why I emphasized modern .NET. All I/O should be using async methods through the entire application. Wrapping sync code in async causes troubles, but that is entirely avoidable in new code. That's the price you have to pay to make this particular abstraction work well, everything I/O must be async.

▲JamesSwift an hour ago | parent | prev | next [-]

Modern .net is surprisingly performant while also being very high level if needed. So it is very close to being a "learn once" ecosystem. This means you use it to write code for a much broader range of usecases than others, you will have a broader / more mature ecosystem than others, and your potential hiring market is more vast.

▲jeswin 2 hours ago | parent | prev | next [-]

Go is not much more efficient, compared to NativeAOT - though it can be faster in some areas. The big reason why someone would want to use C# is that it's a more expressive language. You can even write your DB queries with LINQ (C# lets you express code as data), making them type-safe.

▲bjoli 3 hours ago | parent | prev | next [-]

Go isn't as much fun. And is usually slower for my work until I bump up the GC and then it uses roughly the same amount of memory.

I have also found c# async to be lighter than go's concurrency story, and dotnet11 is going to make that much more clear.

Now: I write software for fun, not for money.

▲SurajMishra 3 hours ago | parent [-]

So for a requirement where both golang and .net would suffice, would you choose .Net over golang?

▲bjoli 2 hours ago | parent [-]

Yes. Unless I really need CSP, but then I would much rather use f#+hopac because CML is the bee's knees.

For general concurrency where async doesn't suffice, go is nicer than C#, but hopac is nicer than go.

If go had proper concurrentML I am pretty sure I would use go a lot more. Again: this is for hobby projects where I get to choose freely.

▲incidently 2 hours ago | parent | prev | next [-]

I know it's not quite as important in the agentic world, but the .NET tooling (across Visual Studio, JetBrains Rider, and C# Dev Kit for VS Code) is just awesome. Some people might frown upon full-blown IDEs, but sometimes they're just incredibly handy.

▲xnorswap 2 hours ago | parent [-]

Even the non-visual stuff is pretty awesome, claude is able to trace and profile .NET code without skills or MCPs.

▲bob1029 an hour ago | parent | prev | next [-]

The tooling and development UX.

Put things like their remote debugging experiences side-by-side and you will quickly learn why some of us go for the Microsoft tools rather than the others.

▲ozim 14 minutes ago | parent [-]

Exactly C# with .NET is batteries included type of ecosystem where most of stuff is done by Microsoft and if someone is experienced with the stack he can whip up enterprise ready app in no time.

I don’t have much experience with Go lang but what I have seen, there is lots of things one has to implement on his own. Which has its own merits, but to go from 0 to full fledged enterprise app you need more time.

▲retwakm4 9 minutes ago | parent [-]

I'm not a .NET person by any stretch and have been more of a Go person traditionally, but I think from what I've seen IRL, this is accurate.

Go is trying to be like C. Less language features (until recently...), so to solve problems you write more code. Intentionally simple language. Intentionally need a lot of code to implement something substantial. .NET seems more frameworks driven. Go traditionally has eschewed frameworks for doing stuff much like C tends to eschew framework type stuff and prefers smallest dependency reliance as possible.

▲pjmlp 3 hours ago | parent | prev | next [-]

That is an urban myth, CLR was designed with support for C++ in mind.

Also Go is at the stage of C# .NET 2.0, and still plenty of lacking language features.

I really think the creator of C# made a disservice to the .NET community by picking Go for the Typescript rewrite.

▲fodkodrasz 14 minutes ago | parent [-]

Go still has a better deployment story. Single static binary deployment are king. On .Net 8 I was hitting random compatibility issues with single binary application bundles, with System.Data.SQLite, and other libraries. (had to use that one and not he Microsoft one for some legacy compatibility reason, maybe around Guid handling maybe)

▲mdasen 8 minutes ago | parent | prev | next [-]

> go is much more efficient in syntax and memory

I'm going to talk about the second part first. .NET is often deployed with a JIT compiler runtime like Java. That means that hello-world scripts use a lot more memory than Go, but that difference becomes a lot smaller on real-world programs and .NET can use less memory than Go depending on what you're doing.

C#'s concurrency can also be more efficient than Go's since it's coroutine based async/await is a lightweight state machine rather than green threads. That's not to say Go is especially heavy or anything, but it is more overhead.

In terms of "efficient in syntax", Go has a lot fewer features. That's one of Go's biggest strengths and weaknesses.

Here's an example. With Go, you just have struct tags: strings of anything that can be attached to a field in a struct. Let's say you have a User struct and you want to make it so the JSON won't have the user's email in it. You do: Email string `json:"-"`. But what if you mess up and write "jsom" or `json:-` without the quotes? It's basically a meaningless string to the compiler. With C#/.NET, you have annotatons/attributes that are a part of the language and checked as types. You'd do: [JsonIgnore] public string Email. JsonIgnore is an attribute class so your IDE can help you.

There's a lot in Go where the answer kinda becomes "f-it, we'll just use strings instead of having something meaningful." Go talks about how important error handling is, but then you get an error from a function and it's basically just a string. If you're doing good error handling, you want to handle different errors differently, but that's not easy in Go. Frankly, it's not easy in most languages, but this is definitely an area where it felt like Go gave up on creating something good in order to get something out the door quickly enough that Google didn't cancel the project. In a language like Zig, errors are enums and you get exhaustiveness checking. With Go, someone could add another error state to something you're using and you'd never know - or they could change the phrasing of an existing error and you'd silently stop matching on it.

Go's lambda syntax is clunky. func(x MyType) string { x.ToString(); } vs (x) => x.ToString()

There's lots of stuff like that. I'm not arguing that Go is bad, but it has a ton less stuff and that's both a blessing and a curse.

▲netdevphoenix an hour ago | parent | prev | next [-]

Compare the ecosystems of .NET vs golang. No comparison whatsover. IoT, mobile, web (front and backend), cloud, etc. I think Go lacks variety and is more focused on traditional greybeard areas.

▲i_s 3 hours ago | parent | prev | next [-]

Native interop is much better in .NET, that matters a lot for some systems.

▲stackskipton 2 hours ago | parent | prev | next [-]

At former jobs, because people know it and switching from .Net <-> Go generally isn't worth the time to learn other language.

Sure, having a runtime is downside but difference in container size for your average CRUD App doesn't really matter. Performance IME is very similar.

Ops type here.

▲pjc50 2 hours ago | parent | prev | next [-]

What's go's equivalent of LINQ?

▲moron4hire an hour ago | parent | prev [-]

In addition to what the others have said, I also enjoy the extremely robust ringtone reflection system in .NET. I don't know of any other systems that provide more complete detail. Maybe Java, though it's been a while since I've used it. It makes reflection in other languages feel prehistoricaly primitive.