r/csharp • • May 06 '26

Found this beautiful rainbow in our codebase

Post image
1.3k Upvotes

r/csharp • • Aug 17 '26

Is it true in the old days those old school devs like 40+ before they learn C#, They learned C like in the pic?

Post image
798 Upvotes

r/csharp • • Mar 27 '26

Fun Please tell me I'm not the only one always getting this message

Post image
756 Upvotes

r/csharp • • Mar 28 '26

There is more to these methods than meets the eye (you may read description)

Post image
680 Upvotes

Dear C# programmers,

The regular case conversion and string generation commands of C# (ToLower, ToUpper , ToString, TryParse,and so on) take the end-user's Current Culture info into account by default. So unless they are loaded with an explicit, specific culture info like en-US or invariant culture, they will not give consistent results across machines worldwide, especially those set to the Turkish or Azeri languages, where uppercasing "i" or lowercasing "I" gives a different result than a lot of other system language settings, which either use or at least respect the I/i case conversion. Also, ToString gives different decimal and date formats for different cultures, which can break programs in many systems that use non-English system language (which is directly linked to the locale).

Easy remedies against this include using ToLowerInvariant, ToUpperInvariant and ToString(CultureInfo.InvariantCulture)with "using System.Globalization". These methods always use invariant culture, which applies the alphabet, decimal, date and other formatting rules of the English language, regardless of end-user's locale, without being related to a specific geography or country. Of course, if you are dealing with user-facing Turkish text, then these invariant methods will give incorrect results; since Turkish has two separate letter pairs "I/ı" (dotless i) and "İ/i" (dotted i).

Also, for string comparisons; using StringComparison.OrdinalIgnoreCase rather than manual casing conversion will usually prevent these sorts of bugs at the source, and ensure consistent functioning of the program across devices worldwide with various language settings.

TL; DR: Manipulate internal, non-user-facing, non-Turkish strings in your code under Invariant Culture Info; and for user-facing, Turkish or other localized text, use string generation and case conversion methods with appropriate culture info specification.

Thanks for checking the pic and reading! And if you know anyone who is working on a Unity game (which is also C#-based), please share it with them as well!


r/csharp • • Dec 17 '25

What’s a good christmas gift for a programmer?

Post image
662 Upvotes

Hey! christmas is coming up and I’m thinking of getting a gift for a friend who’s a programmer. He recently changed his keyboard, so that’s not really an option, any suggestions? Thanks!


r/csharp • • Jul 26 '26

Meta Do not let this sub be a forum to promote AI Vibe coded slop

620 Upvotes

This is just a warning, I was watching the node sub and almost all post are people promoting their AI Vibe coded slop, this community is known for a different approach, although AI is great, forums should not be places for people which do not have any passion or like the language to not even know it and try to promote a project fully made to scrap a few pennies (I call these projects without soul).

Projects should be promoted, but because you genuinely like or are interested in the language and the concept of the project, rather than asking 3,000 prompts to any AI without even knowing what you are doing or what you are pasting.

Edit: Also, I am sick of publicity to also have it in a place where I go to have fun, check interesting things about the language/tools and watch really interesting projects from passionate people.


r/csharp • • 2d ago Heartwarming

Discussion I went back to writing code and you should also

613 Upvotes

I am now writing code again, like I have for the past decade (bar the last ~5 months). Only using AI as an assistant instead of producing 100% of code with it.

My day to day is in Visual Studio (or Codalus when on my home Linux machine) again. I use LLMs to do the boring parts, or as reference when I'm stuck at something. I can also learn much faster using them.

My output is certainly not as much as when we generated 100% of code and just reviewed it, but I still am many times as productive as before LLMs. Yet I enjoy working again, and it's not soulsucking anymore.

I own my code. I navigate in it. I architected it, and thought of the edge cases myself. I solved issues with my brain. Yeah Opus 5.5 could do a haphazard job of it, but after I saw what it slopped out many times, I just don't trust the IPO hype anymore.

I even had to look up syntax today. I was reading C# 15's new features post on my lunch break and was thinking of how I can apply it to the issues I've encountered in codebases.

I feel happy in my job again. I love coding and C# and software development.


r/csharp • • Jun 11 '26

Showcase Weekend project that got out of hand. I wanted my mouse cursor to rotate and point in the direction I'm moving it - like the aiming arrow in Worms 3D

Post image
611 Upvotes

I built this for fun and posted it on r/Worms a few days ago - it got a surprisingly warm reception, and a fair few people there asked how it actually works. So it's clearly not just a thing for Worms fans, and I figured the .NET crowd might enjoy the technical side.

What it does: my mouse cursor rotates to point in the direction I'm moving it - like the aiming arrow in Worms 3D. Started as a weekend project and got out of hand.

How it works, roughly:

  • WinForms system-tray app (.NET 8), no window.
  • A mouse hook tracks the cursor position; I compute the movement angle from the delta between frames.
  • I render the cursor bitmap rotated to that angle and swap it system-wide via SetSystemCursor.
  • Then I couldn't stop, so I themed all 14 standard cursors with little physics: the wait/busy cursors spin with rotating rings, the I-beam sways, resize cursors stretch.
  • Packaging + auto-update via Velopack.

The fiddly parts: smoothing the rotation (raw angle is jittery, needed easing), and restoring the original cursors cleanly on exit so you don't get stuck with a spinning arrow if it crashes.

It's open source (MIT) if you want to poke at the code - repo link in the comments. Happy to answer anything about the cursor-hooking side, it was a fun rabbit hole.

EDIT: Repo link: https://github.com/dawidope/WormsCursor


r/csharp • • Feb 19 '26

Tutorial C# Colorfull "Hello, world!"

Post image
582 Upvotes

r/csharp • • Oct 16 '26

Discussion C# once again the fastest web framework

Post image
545 Upvotes

With all those discussions about Microsoft porting stuff to Rust, it’s nice to see that C# does not need to hide when it comes to performance. There has been quite a lot of movement at the top of the leaderboard over the last few weeks (two weeks ago, first place was around 6850), so I’m interested to see how this race continues. This is the non-tuned section, so frameworks need to be stable and production-ready. Interestingly enough, the C# one is the most high-level of the leading frameworks, API-wise.


r/csharp • • Apr 04 '26

Fun Coding in car

Post image
528 Upvotes

runs Android and now c#...


r/csharp • • Apr 24 '26

Fun Gets me every time

Post image
487 Upvotes

r/csharp • • May 20 '26

Senior dev... I don't think I can pass an interview

465 Upvotes

I need a sanity check... I have been actively working my whole career, head down, creating all modern styles of projects.. DI, service style architecture, asynchronous, .net 9, mvvm, blazor, nosql, webapi, etc..

I am looking for a new role and I feel like i can not answer basic questions, such as:
What are managed and unmanaged pieces of code? Explain code compilation in C#.,What's serialization? What are some common places to find a deadlock? What's the primary use of delegates? etc..

I am literally a blank, I have been working not taking c# courses... does anyone feel this way? I have 25yoe and I feel like I am toast


r/csharp • • Jan 08 '26

News C# is language of the year 2025

Thumbnail tiobe.com
376 Upvotes

For the second time in three years, C# has been awarded “Language of the Year” 2025 by the TIOBE Index.

The award goes to the programming language that gains the most popularity during a given year. TIOBE measures popularity using its own index, which is based largely on search engine results and online references across sites like Google, Wikipedia, and Stack Overflow. At the end of the year, they compare how much each language’s index score has grown from January to December, and the one with the biggest increase wins.

C# is also the fastest-growing language in the TIOBE top 10, with a growth rate of +2.94%. C follows at +2.13%.

What are the most important factors that influence your decision to work with C# and .NET?

Let me start first:

  • I find the language design both efficient and aesthetically pleasing.
  • The technology ecosystem is vast and mature, encompassing everything from microservices and desktop applications to embedded systems and game development.
  • There’s a wealth of free tools and resources available (most importantly, I really enjoy working with Visual Studio IDE).

r/csharp • • Apr 20 '26 Polished Gold Turd

Showcase I create an MMORPG server in .NET 10 and I'm quite impressed with the performance

Post image
367 Upvotes

I've been recreating an old school MMORPG in Phaser (JS/TS) and C# in the server side, and I must say, the server performance is exceptionally good, at least in stress testing.

On my M1 Macbook Pro, I managed to clock in 4000 concurrent connected clients performing expensive operations at around 10k req/s. I probably could squeeze a bit more out of it if I did spread the players around in more game worlds.

I'm also impressed with all the optimisations that can be applied these days to reduce the pressure on heap to reduce the GC pauses. During the stress test window I can run it in a mode that produces so little garbage that I'll get only couple of GC events total, not running more than few millisecond stop the world pauses.

About the project: https://github.com/ErkoKnoll/helbreath-base-game

More about the performance optimisations and stress testing I performed: https://github.com/ErkoKnoll/helbreath-base-game/tree/master/multiplayer/server#performance


r/csharp • • Sep 19 '26

News I made C# running on ESP32-S3(Xtensa architecture)

Thumbnail
gallery
364 Upvotes

I made my own C# compiler that translates C# IL code into LLVM IR, which is then compiled into machine code. Here is the source code: https://github.com/nifanfa/IL2LLVM

​I would argue that C# is the best language to use, but its original runtime is too heavy and impossible to port to MCUs.

This is just a showcase; I mainly use IL2LLVM for UEFI programming: https://github.com/nifanfa/BootTo.NET

​I also tried it on STM32, but STM32 is terrible for this — most STM32 chips have less than 128KB of ROM.

Every method uses the cdecl calling convention, which is how Console.Write works.

CoreLib.cs
public static partial class Console
{
    [DllImport("*")]
    public static extern void Write(ByReference<char> value);
}

Runtime.cpp
void System_Console_Write_System_ByReference_System_Byte(const char* value)
{
    if (value != nullptr)
        fputs(value, stdout);
}

DllImport doesn't pass strings or arrays as pointers like the CLR, so there must be a wrapper. There is an implicit operator on ByReference<T> to get the pointer from strings or arrays.


r/csharp • • May 29 '26 Bravo

Fun [C# / .NET] Tried making my first "aesthetic" terminal project, a wave simulator. Still a beginner!

Post image
361 Upvotes

This was my first time trying to build something using math, and honestly, my brain fried about three times, and it took me two full days just to wrap my head around it. I tried to make the project super easy to modify for personal preferences and custom setups.

Every time you press something on your keyboard it creates a wave.

GitHub Repository: https://github.com/MarujoEn/ascii-wave.git

OwO


r/csharp • • 16d ago

News .NET 11 is out now! 🎉

Thumbnail
devblogs.microsoft.com
336 Upvotes

r/csharp • • Mar 25 '26

Fun Jetbrains AI assistant isn’t quite there yet

Post image
313 Upvotes

I wouldn’t be mad if it at least returned 42


r/csharp • • Jan 29 '26

Teacher said always use 2nd pattern. Is he right?

Post image
301 Upvotes

r/csharp • • Jan 11 '26

Fun Fun Fact: you can use the Win32 API to make a window manually just like you can in C++

Post image
284 Upvotes

It's funny, you do it the same as in C++. This has basically 0 upsides over just using Winforms, but it's fun nonetheless :D
What you get is a low-overhead (as it's using LibraryImport with NativeAOT, more performant than P/Invoke) 1MB executable with no dll's that instantly open a window. There's no real reason to do this other than experimenting, though.

You can even add buttons and stuff to it, it's pretty cool


r/csharp • • 29d ago

News Qt Bridge for C#

Thumbnail
qt.io
281 Upvotes

Hello, Miguel from Qt (qt.io) here. I wanted to share something that I believe will be of interest to many of you. Since 2025, we at Qt have been working on a way to give access to Qt Quick and QML to developers working with languages other than C++. We began this project, which we've named Qt Bridges, by focusing on Rust and C#, and I'm happy to finally be able to tell you that we've just released a Technology Preview for both of these languages. If you are familiar with Qt, you're probably aware of its multi-platform, GPU-accelerated UI framework. If this is the first time hearing about us, now you know that there is another option to design the UI for your C# applications. We would love for you to try it out and leave us your feedback. You can find out more in the Qt blog.


r/csharp • • Apr 05 '26

Blog Unions in c# 15

268 Upvotes

r/csharp • • Sep 26 '26

Yes, C# actually runs on bare-metal UEFI—tested on real hardware!

267 Upvotes

I have been doing UEFI programming in C# ever since MichalStrehovsky started a project called zerosharp on GitHub 4 years ago, demonstrating C# running on UEFI.

nifanfa/BootTo.NET: Providing a minimalist C# UEFI runtime with asynchronous support

However, Native AOT is still too heavy to port to these low-level environments. The worst nightmare is the GC. Because C# is a high-level programming language, even simple string concatenations can lead to memory leaks without a GC. To solve this, I eventually created a custom IL compiler called IL2LLVM. Every method is based on the cdecl calling convention, making it extremely easy to call C/C++ methods.

nifanfa/IL2LLVM: A compiler that translates .NET IL into LLVM IR for multi-architecture native code generation

BootTo.NET acts more like a custom C# environment running directly on UEFI, completely independent of Windows, Linux, and macOS and tested on real hardware. Since UEFI provides basic File System and Network access, it becomes a surprisingly powerful environment.

I managed to build an HttpClient (with TLS support) as well as an FTP server, allowing you to essentially turn it into a NAS system. I also ported classic games like Doom (1995) and Quake (1996), along with an NES emulator, which are definitely worth trying!

Everything starts here...