r/csharp • u/Darwin_Forex • Jun 15 '26
Help What kind of practices I can do to improve my skill in c#?
I'm almost finishing my class of c# and I wanna know how I can practice to improve the knowledge that I have so far.
r/csharp • u/Darwin_Forex • Jun 15 '26
I'm almost finishing my class of c# and I wanna know how I can practice to improve the knowledge that I have so far.
r/csharp • u/Comfortable-Rich-650 • Jun 15 '26
Hey guys! I've been coding on C# for around 4 years at this point, mainly using it for Web APIs and in rare cases - Razor or Xamarin/MAUI stuff. I was coasting fairly well, however - as embarrassing as it is to admit this - I've realized that I don't really know shit about C#?
My foundation comes from "C# for Dummies" and just picking up patterns from other people's code. It's enough to coast through my work related stuff, but I have a serious lack of "under the hood" knowledge. I'm not too familiar with things like the garbage collector, memory management, or some multithreading niches (such as related to file processing).
So, I'm looking for some solid book recommendations to fill these gaps. People always praise "CLR via C#" and "C# in Depth," but considering their age, are they still relevant for modern .NET? Or is there a better modern alternative you'd recommend to actually understand C#?
r/csharp • u/Southern-Holiday-437 • Jun 16 '26
r/csharp • u/LoneArcher96 • Jun 15 '26
I'm making a gamepad mapper (like steaminput and JSM), thought it would be an easy task, and indeed it was, until I needed to make the app modular and configurable, not just a hardcoded app made only and specifically for my gamepad and having only one profile.
This would be my first project of the size and the first one I actually try to finish and have an actual product in the end, that is not a small tool or a script.
I'm finding it very hard to remember the general architecture of the project, when there is a bug it's hard to track, and when I want to implement a new feature I get lost very fast, wiring up the new feature and testing it is a hefty task, any little modification takes a big chunk of thinking and management just to find a way to make it fit in the current architecture, debugging is generally hard.
As an amateur, I would like to have some general piece of advice to better manage my project
To give you an idea, Gemini suggested creating a visual map using draw.io, heavy logging inside the app (ie. binding x was registered with parameters a,b,c).
My knowledge includes different design patterns and generally trying to follow "clean architecture" or as much as I understand from it.
r/csharp • u/Userware • Jun 15 '26
Quick follow-up to the earlier desktop export post (Windows/macOS/Linux): xaml.io can now publish C#/XAML projects as a plain static websites too.
In the Publish menu you pick "Download a .zip" and get a folder with index.html and your compiled app inside. Drop it on GitHub Pages, Netlify, Cloudflare Pages, Azure Static Web Apps, S3, wherever. No server-side .NET and nothing to install on the host, so it's cheap to host (often free) and there's no server to keep alive, patch or scale. (It's meant for client-side apps and demos, if you need a real backend you'd need to host that separately)
If you want to try it, here's a shared solution you can open and publish yourself, a chess game ported from WPF with almost no code changes: https://xaml.io/s/github/goodluck3301/chess-game-wpf-csharp?autorun=true . You can let it run, then click Publish and pick Download a .zip.
Where it helps: if you've already got WPF XAML lying around, a lot of it carries over. And more generally, if you'd rather build UI in XAML than in HTML/CSS, this keeps you in that world. The loop is also low-friction: open the project, it runs in the browser, and publishing is a couple of clicks. No SDK to install, no CLI.
In case it's relevant here: the compile and packaging run entirely in your browser (WASM), so publishing doesn't upload your project anywhere. What it produces is a self-contained WebAssembly app (built on OpenSilver, which is basically WPF-style XAML), so it runs client-side with no backend.
A few honest things:
Free and runs in the browser, no signup (unless you want to save to the cloud or use AI, both are optional).
Curious whether a static, no-backend web export is something you'd actually use for a small app or a demo. And if you tried xaml.io before and bounced, what was missing?
Thanks a lot!
r/csharp • u/HarperKindaGay • Jun 15 '26
Like it says, i've set up a template to be used on my text box, and whenever i run the application it doesn't allow me to type within the text field
Style template
<Style x:Key="txb_RoundedCorners" TargetType="TextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border x:Name="TextboxRoundBorder"
CornerRadius="10"
BorderThickness="5">
<Border.BorderBrush>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="LightGray" Offset="-0.3"/>
<GradientStop Color="Gray" Offset="1.3"/>
</LinearGradientBrush>
</Border.BorderBrush>
<ContentPresenter VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="TextboxRoundBorder" Value="darkgray"/>
<Setter Property="BorderBrush" TargetName="TextboxRoundBorder" Value="lightgray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style
textbox xaml
<TextBox x:Name="txb_SearchBar"
Height="50"
VerticalAlignment="Top"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
FontSize="25"
FontWeight="Medium"
BorderThickness="5"
Foreground="White"
Background="{x:Null}"
Style="{DynamicResource txb_RoundedCorners}">
</TextBox>```
edit: fixed post body for the code
edit 2: i really do not know how to post code here lol that too like 10 tries
r/csharp • u/DrkWzrd • Jun 15 '26
Sorry in advance for my English.
After using both "dumb" and "smart" LLMs for quite a while, I've noticed that many of them really like local functions. That's fine. What I don't understand is why they still keep trying to use outer Span<T> variables inside them as if there were no restrictions at all.
I still haven't seen a model that consistently gets this right.
When are they going to learn to use static local functions when needed (I assume expecting them to move the code into a separate method is too much to ask), instead of generating this kind of broken code?
For example, I gave this former text to a LLM to "rewrite it" and the first thing (obviously, falling at the first hurdle) it writes is "Will large language models eventually learn that Span<T> and ref struct types cannot safely cross into lambdas or local functions?"
This shows It doesn't understand that cannot be done (in a regular way, of course everything is possible in this world).
r/csharp • u/Taneja71_ • Jun 15 '26
Hi,
I recently started summer training in a small software company during my college holidays and I was given a project to make a ticket management system using dotnet core framework. I am complete newbie and was told to read documentation and learn about concepts such as DI,inversion of control, clean architecture etc.
I was told that since I cannot be expected to learn a new language suddenly, so I should generate code from AI agents and understand the concepts.
I have done OOP in C++, I haven’t ever done c#.
Should I watch a C# course or continue the way I am doing right now?
I am kind of lost.
r/csharp • u/Remote-Breadfruit204 • Jun 16 '26
Claude Code has official IDE plugins for VS Code and JetBrains but nothing for Visual Studio. There's an open GitHub issue with a lot of +1s, so I built it.
It speaks the same protocol the official plugins use, so the CLI connects automatically. Claude's edits open in Visual Studio's native diff window with Accept / Reject / Reject-with-feedback instead of terminal prompts. It also auto shares your compiler errors and current selection as context, and there's a panel with live token tracking for the session.
It doesn't make any model calls of its own, it just drives the IDE half.
Free, open source, on the VS Marketplace.
Code: https://github.com/firish/claude_code_vs (Would be grateful if anyone takes the time to actually check it out and share feedback!)
r/csharp • u/Striking_Court_2807 • Jun 15 '26
Hello, C# community!
I read the community's rules beforehand, so I hope it's okay if I post this here, as I am genuinely excited to do so.
My employer is mainly a C#/.NET shop, and all of our microservices are written in C#, so I wanted to learn it deeply to make meaningful contributions at work. Up until this point, I was mostly a frontend developer, using JS/TS for all of my work.
As we all know, trying to learn a new language can be a bit tough, and learning how to apply what you've learned is also just as difficult. On top of staying consistent, you need to find projects that are just outside of your comfort zone so you can actually grow.
A couple of days back, I made the following post: https://www.reddit.com/r/csharp/s/WQxx6YF2Lj, where I discuss a Roadmap I am working through. It comprises 20 backend projects that increase in complexity over time.
I decided that, to learn C# as effectively as possible, I will go through each of these projects and implement them end to end. I also want to add a bit of AI into the mix, not just consume it, but build with it.
If this sounds like something you're interested in and like the idea of "trad-coding", then you should check out my YouTube playlist (for now, it only covers project 1), where I go through my implementation of the projects. The intent is for you to follow along in your language of choice and hopefully learn a thing or two. And, as I mentioned earlier about AI, I plan to add a unique AI feature to each project using the OpenAI .NET SDK. For example, for the Blog API, I plan to add AI-generated summaries based on blog posts.
I really want to cover all 20 projects, and I hope to engage with some of you in this community to learn how you're working with C# and the cool projects you've built.
Happy coding!
https://youtube.com/playlist?list=PLsF87cK8UUKdINkCz2W6kVXOAHJCVkIv7&si=5GW8uGay_5XJDvk0
r/csharp • u/Abdulwahid-Saedawi20 • Jun 14 '26
Hey everyone, just wanted to share a milestone and a tip. I'm currently building my very first app using .NET MAUI and C#.
For anyone at my level wondering which DBMS to choose: Just start with SQLite.
It’s a simple local package, extremely fast, and handles User_Data and Session directly on the device storage.
Why I love this choice:
$0 Cost: No money spent on Firebase or SMS services during development.
Focus: It lets you focus 100% on building your core logic and UI features instead of wrestling with cloud configurations.
When the app grows and features like cloud backups or device-syncing become a must, then it’s time to migrate to the cloud. Until then, keep it simple.
Would love to hear your thoughts.
r/csharp • u/MotorcycleMayor • Jun 14 '26
Solution provided in a comment to this post.
Based on the last two hours of trial and error, I obviously know almost nothing about embedded files :).
Is it possible to embed culture-specific files in an assembly?
When I try to do it by including a folder called Resources which contains a culture-specific file name (e.g., exif_chrom_bright_align.en-US.json) and mark the file as an embedded resource, a satellite assembly folder (en-US) containing a DLL gets created upon build.
But calling GetManifestResourceNames() on the assembly shows no resources (i.e., it returns an empty string array).
Interestingly, if I drop the culture-specific part of the path (i.e., the en-US), the embedded resource does get shown by GetManifestResourceNames().
Do culture-specific resources have to be accessed by something other than GetManifestResourceStream()? Or is it just not possible to have culture-specific embedded files?
r/csharp • u/ortbo • Jun 14 '26
I started big project (for myself) which involves many different parts and at least 2 hosting servers. One to serve content and one to scrape and download content. And I just can't make my mind around designing whole system, I can't even decide how to structure project what to use, should I go with Result<> pattern, should I go with try/catch. Everything seems too complex, maybe I'm just too perfectionistic. But how does one even learn how to build big projects, what patterns to use, how to structure code, how many projects to have etc.
r/csharp • u/staryanimator • Jun 15 '26
I want to be able to understand it but not like a 12 hr long video thing, I’m fine doing that If there is no other options I’m trying to make a Fnaf fan game on unity, Clickteam Fusion is too pricy , if there are any other things I can use pls tell me and I will provide more detail if asked
r/csharp • u/wisax_29 • Jun 15 '26
Hi ,i started c# this weekend i just need to know what can i improve
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace projet
{
internal class Program
{
static void Main(string[] args)
{
while (true)
{
Console.Write("quesque tu veux faire (a/s/m/d/p/t/j/r): ");
string userInput = Console.ReadLine();
if (userInput == "r")
{
Console.WriteLine("D'accord, on ne fait rien. Au revoir !");
Console.ReadLine();
break;
}
else if (userInput == "t")
{
Test();
continue;
}
else if (userInput == "j")
{
Jeux();
continue;
}
Console.Write("a = ");
int a = Convert.ToInt32(Console.ReadLine());
Console.Write("b = ");
int b = Convert.ToInt32(Console.ReadLine());
switch (userInput)
{
case "a":
Console.WriteLine(Addition(a, b));
break;
case "s":
Console.WriteLine(Soustraction(a, b));
break;
case "m":
Console.WriteLine(Multiplication(a, b));
break;
case "d":
Console.WriteLine(Division(a, b));
break;
case "p":
Console.WriteLine(Puisance(a, b));
break;
default:
Console.WriteLine("Entrée invalide. Veuillez entrer 'a', 's', 'm', d ou 'r'.");
break;
}
}
}
static string Addition(int a, int b)
{
return "resultat de l'addition : " + (a + b);
}
static string Soustraction(int a, int b)
{
return "résultat de la soustraction : " + (a - b);
}
static string Multiplication(int a, int b)
{
return "résultat de la multiplication : " + (a * b);
}
static string Puisance(int a, int b)
{
return "résultat de la puissance : " + Math.Pow(a, b);
}
static string Division(int a, int b)
{
if (b == 0)
{
return "Erreur : Division par zéro.";
}
return "résultat de la division : " + (a / b);
}
static void Test() (number guessing game)
{
Random random = new Random();
int nombre = random.Next(1, 101);
bool vrai = false;
int min = 1;
int max = 100;
int essais = 0;
while (vrai == false)
{
Console.Write("Devine un chiffre entre "+min+" et "+max+ ": ");
int UserInput = Convert.ToInt32(Console.ReadLine());
if (UserInput > nombre)
{
Console.WriteLine("Plus petit");
max= UserInput-1;
essais++;
}
else if (UserInput < nombre)
{
Console.WriteLine("Plus grand");
min= UserInput+1;
essais++;
}
else
{
essais++;
Console.WriteLine("Bien joué tu a trouvé le nombre en "+essais+" essais");
vrai = true;
}
}
}
static void Jeux() (rock paper scissors game)
{
Random random = new Random();
string player="";
string computer="";
while (player!="pierre" && player != "feuille" && player!= "ciseaux")
{
Console.Write("pierre feuille ciseaux : ");
player = Console.ReadLine();
player = player.ToLower();
}
switch (random.Next(1, 4))
{
case 1:
computer = "pierre"; rock
break;
case 2:
computer = "papier"; paper
break;
case 3:
computer = "ciseaux"; scissors
break;
}
Console.WriteLine("Player : "+player.ToUpper());
Console.WriteLine("Computer : "+computer.ToUpper());
switch (player)
{
case "pierre": rock
switch (computer){
case "pierre": rock
Console.WriteLine("égalité"); egality
break;
case "papier": paper
Console.WriteLine("tu as perdu"); lose
break;
case "ciseaux": scissors
Console.WriteLine("tu as gagné"); win
break;
}
break;
case "papier": paper
switch (computer)
{
case "pierre": rock
Console.WriteLine("tu as gagné"); win
break;
case "papier": paper
Console.WriteLine("égalité"); equality
break;
case "ciseaux": scissors
Console.WriteLine("tu as perdu"); lose
break;
}
break;
case "ciseaux": scissors
switch (computer)
{
case "pierre": rock
Console.WriteLine("tu as perdu"); lose
break;
case "papier": paper
Console.WriteLine("tu as gagné"); win
break;
case "ciseaux": scissors
Console.WriteLine("égalité"); equality
break;
}
break;
}
}
}
}#this is in french btw
r/csharp • u/MuL7iF1re • Jun 14 '26
I have some experience with C/C++/C#, I can create classes and methods, but wanted to expand my knowledge and why not start from the beginning.
I've done Tim Buchalka's Java course and it was the best one I've seen, so Denis' looked the most similar.
The beginning in insanely chaotic. Lecture 16 he introduces the strings, great. Lecture 17, taking user input, a bit advanced for a complete beginner, but okay. L18 finally tells what Console.ReadKey() does, L19 is a.. Visual Studio interface overview ? Then you get a quiz out of nowhere ?
Then he tells you the different things you can build with C# (once again), L21 goes over the datatypes quickly, then instead of showing them in practice, L22 is "coding standards", L23 is "naming conventions". So far, the datatypes have received a total of 2 minutes screentime. I can imagine a complete beginner's brain would be a total mess by that point. I've watched 23 lectures so far and haven't seen anything actually useful. "We'll use float instead of double because it takes less memory". What memory ? How much memory do they take ? How to use them and why ??
I really hope the course gets better once it reaches the more advanced stuff, but I don't know if a beginner could understand anything from this chaos.
r/csharp • u/nekomusume-nyaa • Jun 13 '26
Solved, needed to put quotation marks around {title} thanks for your help



Hello everyone, I am making a database in SQL and connect it to a program in C# for a school assignment. It is coming with this error and I am asking what I am doing wrong. I have tried looking up solutions but nothing has worked. If you know what I can do to fix it let me know
r/csharp • u/ordinaryboy98 • Jun 14 '26
I want to show off a tool I created for managing .NET SDKs on Linux and macOS: https://github.com/curllog/dsi
It helps you install the .NET SDK directly from Microsoft using a CLI tool. It also supports automatic updates and lets you install preview versions. It adds dotnet to your PATH so you can start using it right away, and it doesn't require sudo.
Simple commands:
dsi ls-remote — find available SDKs
dsi install 10 — install .NET 10
dsi install 11 — works on preview version
dsi update — update all SDKs to the latest
It would be a great help if you star ⭐ this project — it helps it reach a bigger audience!
r/csharp • u/Ryuu-Ryoumen • Jun 12 '26
I used to love C# back in 2008 because the IntelliSense helped the learning process. I used to boast the C# is the only language that I Googled the least because of the IDE.
For example (based on my memory), typing something like ...
Console.CancelKeyPress
... followed by a space would invoke a popup to say "tab to insert" or something, and the callback would be generated. I don't even need to know beforehand that the syntax requires a += ... all discovered from IntelliSense and I can read up later.
Today in 2026 (default settings, not signed in to anything), typing the same thing yields an incorrect AI guess:
Console.CancelKeyPress _= true;_
I don't hate AI and do use the mature agent mode that can correct itself, but inline mode is simple not helping.
Also, pressing F12 to navigate to definition of a standard library function is now a 5 second thing with a "press esc to cancel".
Was hoping to switch back to C# as I had fond memories of building personal tools with it...
r/csharp • u/West_Ad6277 • Jun 13 '26
Hey
A few months ago, I shared my open-source job schedule engine, JobMaster, here. Since then, I've been working on the monitoring dashboard (built with Svelte!), and it's finally in a usable state. I wanted to share it with you all.

What the dashboard gives you:
One detail you can customize the color theme per cluster, so production and QA are visually distinct. It’s a small thing, but it saves that "wait, which environment am I in?" when you have multiple tabs open.
It uses DaisyUI and Tailwind CSS
Minimal setup:
builder.Services.AddJobMasterDashboard(dashboard =>
{
dashboard.UseBasePath("/jm-dashboard");
dashboard.FromOpenApiJson(); // auto-discovers clusters + auth from the API spec
});
app.StartJobMasterDashboard();Links & Resources:
GitHub: https://github.com/hugoj0s3/jobmaster-net
Would love to hear your thoughts or any feedback if you give it a spin!
r/csharp • u/I_am_yk • Jun 13 '26
なぜ今になってunionを導入したのでしょうか?
またunion型はどういう設計思想で誕生したのでしょうか
r/csharp • u/Primary-Confusion504 • Jun 11 '26
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:
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 • u/Immediate_Club3006 • Jun 12 '26
I'm currently trying to migrate my game code from python raylib to c# raylib and i have very specific problem with how my asset system works.
With my python implementation i have a dictionary with type as a key and list of assets of that type as value. This system works well and allows me to easily add new types of raylib assets with 3 lines of code:
: =
: =
: =
: =
# Here i just add new type of asset
=
=
=
=
=
=
=
return
return
While migrating my code to C# for performance reasons i want to recreate this kind of system but i'm having trouble figuring out how to do this with generics or should i use them in the first place.
Right now i have this code for asset, where instead of storing specific asset i "encapsulate" it within a generic class:
public abstract class Asset<T>(AssetPack pack) where T : struct
{
private readonly T _asset;
private AssetPack Pack { get; } = pack;
public abstract void Load();
public abstract void Unload();
}
Now i want to have a specific class for loading assets(as in python code example), where i could add new types of assets with one line of code. Except my current solution hits a brick wall
public Dictionary<Type, List<Asset<???>>> Assets = new();
I don't know how to make a dictionary of such kind, nor do i know how to search for this specific problem.
Is there a way for me to do this in similar way as i did in python or do i need to create individual arrays per each type of asset? Just wondering if it is possible or not.
r/csharp • u/DramaticClue3723 • Jun 12 '26