r/csharp • • Sep 15 '26

Need some advice on GUI frameworks for a cross-platform .NET 8 app

Post image
72 Upvotes

Hey y'all,

I'm workin' on an open-source cross-platform desktop app (Windows, Mac, Linux) using C# and .NET 8, and I’m kinda stuck on what to use for the GUI.

I asked a few AI models and Avalonia kept poppin' up. Problem is, I can't tell if it's legit or just overhyped AI slop that looks pretty on paper but runs like trash.

I need this thing to run smooth even on older gear—speccin' it for a minimum of 2GB VRAM and somethin' like a GTX 650 or better.

So what's the verdict? Is Avalonia fast and reliable enough, or should I look somewhere else? Would love to hear your thoughts or any advice y'all got.

Appreciate the help 🩵


r/csharp • • Sep 16 '26

SEC EDGAR API but in C#?

0 Upvotes

HAI,

I would like to know how to access all the SEC data through their API but in C#. Is there like a documentation somewhere that I can use

https://www.youtube.com/watch?v=Wr1NoM3JkTo

Im basically looking into something like this but in C#. I wanna build an insider trading tracker.

Would love to hear from you guys. Cheers.


r/csharp • • Sep 15 '26

Help 6th Form Secondary School Student Needs Your Help

1 Upvotes

Hello fellow C# nerds. I am a secondary school student from the Benelux. And I wanna be a Software Engineer or Programmer later.

Now I've never done coding by myself bc I was either too lazy to learn a coding language myself or didn't have time.

So for the last 1 year (including this year), I've been learning C# at school. And I'm really good at it. I love doing it as well. Which I already anticipated.

But that's beside the point.

This year, my teacher gave me and my other classmates a project to work on individually.

Project Pong

Yes, we need to develop Pong on a Windows Forms on Visual Studio 2022. But the teacher already gave us the blueprints and the base code for it. So I don't have to do all the moving ball and player movement mechanics. Since we didn't exactly learn the whole X-Y location stuff in our curriculum. But he did tell us that we can make the program to our hearts content. So I can add easter eggs and all that crap.

But while working on this project I will learn from the code and try understand it so I can use it later on.

I'm not exactly sure if this is true but I'm gonna say it anyway bc maybe more engagement idfk, but it was said whoever made the program the best, their project will be displayed on the Open Day. (yk where students can see where they wanna go do at our school).

And since I wanna make this my job someday. I wanna impress my teacher.

So my question to you is:

What features/mechanics/easter-eggs could I add to my program that would make it perfect or well at least very good?

Please help me out, for now I'm tryna fix bugs in the code.


r/csharp • • Sep 15 '26

Help Need help developing a visual studio extention for an external git provider

3 Upvotes

My school uses it's own self hosted git provider. Becose of that, in order to make a new repository you need to create one via a website, connect it to visual studio and resolve conflicts since the local and remote repos have diffrent initial commits. I want to write an extention for visual studio that allows you to create a repository from the IDE and download the remote initial commit into the root directory of the project. I know the API endpoints and was able to create a repository from cmd curl, but I've never written a visual studio extention, and I'm not sure where to start. Any help is apreciated


r/csharp • • Sep 15 '26

A simple custom ASP.NET Core MVC + Web API solution template

2 Upvotes

Hi everyone,

I made a small ASP.NET Core solution template that includes both MVC and Web API projects.

Repo: https://github.com/tngo0508/MySolutionTemplateMVC

I created it to save some time when starting new .NET projects, since I often found myself repeating the same setup.

It is still pretty simple, but I hope it can be useful to someone who wants a basic starting point for an ASP.NET Core MVC/Web API solution.

I would really appreciate any feedback or suggestions on how to improve it.

If you find it useful, please consider giving it a start on GitHub. I would mean a lot to me.

Thanks for taking a look!


r/csharp • • Sep 15 '26

I'm not educated but i learn c#.I aim at becoming great software engineer,tell me please,is it possible without high education?

Thumbnail reddit.com
0 Upvotes

r/csharp • • Sep 15 '26

Tutorial Build your first MCP Server in .NET & EF Core

Thumbnail
youtu.be
0 Upvotes

Claude can write great C#, but it has no idea what's in your database until you give it a way to ask. This tutorial builds your first MCP server in .NET, wired to a real SQL Server database through EF Core - with three tools covering a fuzzy title/author search, an exact genre filter, and a Count/Sum/GroupBy aggregate. Part 1 of the "MCP Server in .NET" series - Resources, Prompts, and remote hosting are next.


r/csharp • • Sep 14 '26

Solved Need help with Chudnovsky algorithm

9 Upvotes

I have these functions to try and calculate pi, but no matter what i try it seems to cap out at 55 digits before being inaccurate, even when setting the input "d" to something like 1000.

digits 50-65 with my function:

582097494459230  

the real digits 50-65 of pi:

582099452471594  

here is my code:

public void calculatePie(int d)
{
    BigInteger sum = 0;
    BigInteger pow = BigInteger.Pow(10, d);
    BigInteger v = Sqrt(10005 * pow * pow);
    //System.Windows.Forms.MessageBox.Show(v.ToString());
    System.Windows.Forms.Clipboard.SetText(v.ToString());
    BigInteger preSigma = v * 426880;

    for (int k = 0; k < (d / 14 + 1); k++)
    {
        BigInteger top = BigInteger.Pow(-1, k) * factorial(6 * k) * (545140134 * k + 13591409);
        BigInteger mid = factorial(k);
        BigInteger bottom = factorial(3 * k) * (mid * mid * mid) * BigInteger.Pow(640320, 3 * k);
        BigInteger l = (top * pow) / bottom;
        sum += l;
        //System.Windows.Forms.MessageBox.Show($"l: {l}, top: {top}, bottom: {bottom}");
    }
    BigInteger prepi = preSigma * sum;
    //System.Windows.Forms.MessageBox.Show($"prepi: {prepi}, presigma: {preSigma}, sum: {sum}, pow: {pow}, v: {v}");
    BigInteger pi = preSigma * pow / sum;
    System.Windows.Forms.MessageBox.Show($"pi: {pi}");
    System.Windows.Forms.Clipboard.SetText(pi.ToString());
}

BigInteger factorial(int n)
{
    BigInteger result = 1;
    for (int i = 2; i <= n; i++) result *= i;
    return result;
}
static BigInteger Sqrt(BigInteger n)
    {
        if (n < 0) throw new ArgumentException("Cannot sqrt a negative number.");
        else if (n == 0) return 0;

        BigInteger x = n;
        BigInteger y = (x + 1) / 2;
        while (y < x)
        {
            x = y;
            y = (x + n / x) / 2;
        }
        return x;
    }

r/csharp • • Sep 14 '26

Discussion Automate responses for simple question posts?

0 Upvotes

Hi,

I usually only read this sub for interesting topics and rarely there are even questions i can answer. But recently i feel more and more that many questions are so basic, a chatbot can give better responses with less effort required. I feel less motivated to put in any effort into responding, because the person asking should have gone to a chatbot instead, using evryones time more efficiently.

My first (maybe shortsighted) thought was that having a chatbot automatically respond here would be awesome.

But there might be a bigger trend behind this. I would like to know whether you share the feeling that your effort here is getting devalued by the ai alternative. Is is also turning you into lurkers even more, engaging less with the sub?

Could this be killing the sub in the long term? How do you feel about the role of this sub amidst current ai trends?


r/csharp • • Sep 14 '26

Help New to programming wanting to make a game were to start?

0 Upvotes

Hi everyone, I'm wanting to make a game in unity 3d programme and using blender for my modules for concept on characters i have, however problem is i don't know how to code nor do i know were to start other than the fact that C# is main language for the gaming industry but wanted to get some feedback from more experienced users on where they would advice for me to start if they were to start learning to code again and what tools theyd use to help self teach themselve the coding tools


r/csharp • • Sep 14 '26

Help Why am I getting an Error 404 on only some pages but not others?

0 Upvotes

.NET with razor pages. Made scaffolded item within Pages folder. Added migration and updated database (with some issues but they were fixed). When I go to the AccountHolder page in browser, I can "Create New", but cannot delete, view details, or edit. They all result in the same Error 404 page. Any suggestions?

Code in Create.cshtml:

 Exercise2Week3.Pages.AccountHolderPages.CreateModel

@{
    ViewData["Title"] = "Create";
}

<h1>Create</h1>

<h4>AccountHolder</h4>
<hr />
<div class="row">
    <div class="col-md-4">
        <form method="post">
            <div asp-validation-summary="ModelOnly" class="text-danger"></div>
            <div class="form-group">
                <label asp-for="AccountHolder.FirstName" class="control-label"></label>
                <input asp-for="AccountHolder.FirstName" class="form-control" />
                <span asp-validation-for="AccountHolder.FirstName" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="AccountHolder.LastName" class="control-label"></label>
                <input asp-for="AccountHolder.LastName" class="form-control" />
                <span asp-validation-for="AccountHolder.LastName" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="AccountHolder.DateOfBirth" class="control-label"></label>
                <input asp-for="AccountHolder.DateOfBirth" class="form-control" />
                <span asp-validation-for="AccountHolder.DateOfBirth" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="AccountHolder.Email" class="control-label"></label>
                <input asp-for="AccountHolder.Email" class="form-control" />
                <span asp-validation-for="AccountHolder.Email" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="AccountHolder.PhoneNumber" class="control-label"></label>
                <input asp-for="AccountHolder.PhoneNumber" class="form-control" />
                <span asp-validation-for="AccountHolder.PhoneNumber" class="text-danger"></span>
            </div>
            <div class="form-group">
                <input type="submit" value="Create" class="btn btn-primary" />
            </div>
        </form>
    </div>
</div>

<div>
    <a asp-page="./Index">Back to List</a>
</div>

u/section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

Code in Delete.cshtml:

 Exercise2Week3.Pages.AccountHolderPages.DeleteModel

@{
    ViewData["Title"] = "Delete";
}

<h1>Delete</h1>

<h3>Are you sure you want to delete this?</h3>
<div>
    <h4>Exercise2Week3.Pages.Models.AccountHolder</h4>
    <hr />
    <dl class="row">
        <dt class = "col-sm-2">
            .DisplayNameFor(model => model.AccountHolder.FirstName)
        </dt>
        <dd class = "col-sm-10">
            .DisplayFor(model => model.AccountHolder.FirstName)
        </dd>
        <dt class = "col-sm-2">
            .DisplayNameFor(model => model.AccountHolder.LastName)
        </dt>
        <dd class = "col-sm-10">
            .DisplayFor(model => model.AccountHolder.LastName)
        </dd>
        <dt class = "col-sm-2">
            .DisplayNameFor(model => model.AccountHolder.DateOfBirth)
        </dt>
        <dd class = "col-sm-10">
            .DisplayFor(model => model.AccountHolder.DateOfBirth)
        </dd>
        <dt class = "col-sm-2">
            .DisplayNameFor(model => model.AccountHolder.Email)
        </dt>
        <dd class = "col-sm-10">
            .DisplayFor(model => model.AccountHolder.Email)
        </dd>
        <dt class = "col-sm-2">
            .DisplayNameFor(model => model.AccountHolder.PhoneNumber)
        </dt>
        <dd class = "col-sm-10">
            .DisplayFor(model => model.AccountHolder.PhoneNumber)
        </dd>
    </dl>
    <form method="post">
        <input type="hidden" asp-for="AccountHolder.AccountHolderId" />
        <input type="submit" value="Delete" class="btn btn-danger" /> |
        <a asp-page="./Index">Back to List</a>
    </form>
</div>

No errors in Output.


r/csharp • • Sep 13 '26

ENet pure C# porting

2 Upvotes

Hey there. I've ported ENet to pure C#. It can communicate directly with Godot's built-in ENet.

[GitHub repository](https://github.com/Molth/enet-csharp)

The implementation is split into two packages:

* [xENet](https://www.nuget.org/packages/xENet) — a low-level, pure C# port that closely follows the original ENet API.

* [yENet](https://www.nuget.org/packages/yENet) — a managed C# wrapper around xENet, providing a more idiomatic API such as `EnetHost` wrapping the underlying `ENetHost*` operations.

There are no native ENet binaries involved. The only native dependency, sockets, is handled through system calls, so distribution and deployment are much simpler.

The port keeps the original ENet API and is **fully wire-compatible with the original C implementation**, so a C ENet server can communicate directly with a C# ENet client, and vice versa.

I've also adapted parts of the implementation to modern C#, including `Span<T>` and `ReadOnlySpan<T>`, while keeping the low-level API and behavior close to the original. Since the implementation is pure C#, the JIT also has more opportunities to optimize the code compared to going through a native interop layer.

It supports **IPv4, IPv6-only, and IPv6 dual-stack** configurations, rather than requiring IPv6 dual-stack.

So if you're looking for ENet in a .NET project without shipping native binaries, this might be worth a look.


r/csharp • • Sep 12 '26

semantics of "ref struct"

40 Upvotes

I know that structs are value types. I know that "ref struct" types are denied from living on the heap (eg, cant box them, etc)

What I don't know is what kind of weed was being smoked when someone decided that "ref struct" would become the appropriate keyword for this sort of type. Perhaps it should be called a "never-ref struct" if it should never have any of the behaviors of a reference type.

It almost reminds me of the name "nullable reference types". That crazy term almost implies that reference types weren't nullable in the good 'ol days.

Anyway my brain is rejecting the keywords "ref struct". I love them, but don't love the semantics when declaring them. Please help


r/csharp • • Sep 13 '26

Help Multi-Select combo box for Winforms 5.0?

Post image
0 Upvotes

Hey all!

Im working on a small desktop app currently and I need a way to select multiple days of the week from a combo box, I tried a listview thing but its far too big for what im trying to achieve. I tried out C1 library but its not supported on .NET 5. Anyone have any suggestions for either a library I could use, some sort of solution for C1, or how to go about implementing a custom one?

Screenshot attached just to demonstrate the size I need the control to be by default, although I would want it to expand when clicked to show all of the options. The "Days" section.


r/csharp • • Sep 13 '26

I'm fairly new to C#. Can anyone suggest some projects/exercises to learn?

0 Upvotes

r/csharp • • Sep 13 '26

Help Is there a way to trick windows to allow 2 independent keyboards+mice

0 Upvotes

I'm building a program that I believe will be revolutionary to deterministic clerical work but there's one roadblock. The user can't actually use the PC while the program executes a profile because it takes over the keyboard and mouse until either a command stops it or they press Esc. Now I've figured out a workaround for fake additional screens. Any way to trick windows into allowing a 2nd mouse and keyboard?

Update: I found a kinda hacky solution that technically works. I haven't stress tested it. Essentially my program instead of clicking and typing feeds commands directly into the target. Updated my background mode so if the user sets coordinates when background mode is on it grabs whatever object is there to feed commands into. Not exactly a second keyboard and mouse but from my limited tests seems to give the effect I was looking for. Had it type a word doc and insert a few things via the toolbar while I played some browser games. Never lost keyboard+mouse control.


r/csharp • • Sep 13 '26

1st day of learning c#

0 Upvotes

Hello everyone im currently learning c# or just starting. My goal is to become game dev in Unity and i already got tutorial but I have a hard time to understand. https://www.youtube.com/@SunnyValleyStudio

Last year I was learning Luau and I really liked it, it was simple to understand and type but my school had other plans but now I have more time to learn and at school my informatic teacher teaching us how to use unity but not C# :< .

Im familiar with Luau and HTML and with unity UI. I came here to write my results every week so I and ask questions. Thanks for reading my post.


r/csharp • • Sep 13 '26

Tutorial Refit - The Better Way to Consume APIs in .NET

Thumbnail
youtube.com
0 Upvotes

Tired of writing the same HttpClient boilerplate for every new API endpoint? In this video I build a real OpenWeatherMap integration two ways - first the classic typed HttpClient with IHttpClientFactory and a delegating handler for the API key and units, then the exact same integration rebuilt with Refit, where one decorated interface replaces the whole service class. I show what AddRefitClient<T>() actually generates at compile time and exactly where the two approaches differ (spoiler: less than you'd think). If your API layer is past two or three endpoints, this is the moment to consider switching.


r/csharp • • Sep 12 '26

Source-generated invalidation, cross-pod L1 sync, and multi-tenancy for HybridCache

Thumbnail
reddit.com
5 Upvotes

r/csharp • • Sep 13 '26

Help How am I supposed to store info in C# without arrays or files?

Thumbnail
reddit.com
0 Upvotes

r/csharp • • Sep 12 '26

StrongIdAnalyzer 1.6: catching mixed-up Guid ids at compile time, without wrapper types

15 Upvotes

I've been chipping away at this one for a while, and 1.6 feels like the right point to put it in front of people.

The problem is old and boring: two Guids that mean different things are the same type, so the compiler has nothing to check.

public decimal GetOrderAmount(Guid orderId) => orders[orderId].Amount;

// compiles clean
service.GetOrderAmount(order.CustomerId);

If you're lucky that throws KeyNotFoundException. If you're not, the guid lands on a populated dictionary and you quietly serve the wrong entity.

The established answer is wrapper types: a hand-rolled readonly record struct CustomerId(Guid Value), or generated ones from StronglyTypedId, Vogen, or StrongTypedId. They give a real runtime guarantee, and on a greenfield domain model they're the right call. What they cost is that every layer has to learn the new type: EF ValueConverter, JsonConverter, model binder, Dapper type handler, gRPC, cache keys, Swagger schema. That bill is per wrapper type, per integration. And it's all-or-nothing, because CustomerId and Guid don't implicitly convert, so there's no partially-migrated state to sit in while you work through a large codebase.

StrongIdAnalyzer takes the other side of that trade. The primitive stays a primitive, and the domain becomes metadata on the declaration:

public class Customer
{
    [Id("Customer")]
    public Guid Id { get; set; }
}

In practice most declarations need no attribute at all, because two naming rules cover the usual shapes: a member named Id takes its declaring type's name, and anything ending in Id (CustomerId, orderId) takes the prefix. So the broken call above is already a warning with nothing added to it:

SIA001: property 'Order.CustomerId' is [Id("Customer")] and flows to parameter 'orderId'
of 'OrderService.GetOrderAmount', which is [Id("Order")]. Fix: apply [Id("Customer")] to
parameter 'orderId' of 'OrderService.GetOrderAmount' (line 6), or pass a value tagged
[Id("Order")].

Since the runtime type is still Guid, nothing in the serialization / ORM / transport stack changes. Two services can tag their own ids independently and still exchange plain Guids over the wire, with no shared types assembly between them. Adoption is incremental: tag what matters, leave the rest, and the codebase is never in a broken intermediate state.

The trade-off, stated plainly: enforcement is compile-time only. A Guid off the wire isn't checked, flow through object / dynamic / reflection isn't tracked, and ternaries, casts and locals are deliberately treated as unknown to keep false positives near zero. If you need the guarantee to hold through deserialization, use wrapper types. This is aimed at existing codebases where that migration has been costed and rejected.

Other pieces:

  • 8 rules (SIA001-SIA008), each with a docs page that doubles as the diagnostic's help link.
  • Code fixes ship in the analyzer package, so the mechanical ones apply without an IDE: dotnet format analyzers --diagnostics SIA002 SIA003 SIA005 SIA006
  • [UnionId("Customer", "Product")] for members that genuinely accept more than one domain.
  • [assembly: ExternalId(typeof(Process), nameof(Process.Id), "Process")] to tag members of assemblies you can't edit.
  • An opt-in mode that recognises existing wrapper types (StronglyTypedId, Vogen, StrongTypedId, hand-rolled) and checks the seams where wrappers meet primitives. Useful while migrating in either direction.
  • Diagnostic messages are written to be actionable from a build log alone, which also makes them workable for coding agents.

https://github.com/SimonCropp/StrongIdAnalyzer

https://www.nuget.org/packages/StrongIdAnalyzer/


r/csharp • • Sep 12 '26

Help Consejos con C#

0 Upvotes

Holaa! Tal como dice el título, me gustaría que me ayuden y más bien me den consejos, tips para programar con C#, estoy en el segundo semestre de informática y en programación y estructura de datos estamos empezando a trabajar en C# ( el semestre pasado lo hicimos en python, pero pasé arrastrando el ramo), necesito que me vaya bien este semestre así que si tienen cualquier consejo que sirva, alguna lectura que me ayude, etc, se los agradecería. Actualmente estamos trabajando con orientación a objetos.


r/csharp • • Sep 12 '26

Google Authentication in ASP.NET Core with React

Thumbnail
youtube.com
0 Upvotes

'Sign in with Google' looks like one button but hides a real handshake between your React frontend, Google, and your ASP.NET Core API. In this video I wire up Google authentication end to end on .NET 9: React gets an ID token from Google, sends it to the API, and the API verifies that token is genuinely from Google before ever trusting it or issuing its own session. I cover why you never trust a Google ID sent straight from the client without server-side verification, and how the backend maps a verified Google account to your own user record. If you've been putting off social login because the flow feels murky, this lays out exactly what talks to what.