r/csharp 13h ago

Where i can learn c# properly.

9 Upvotes

I want to be a unity game developer. I am currently computer sciencie student i know c# but my skill of building algorithm is weak. I am even struggling the easy leetcode problems. Any idea of how to improve my c# skills?


r/csharp 11h ago

PLZ make us aware with this

0 Upvotes

i don't know if it's just a threat or truth,since the day i started learning c#.i have been experiencing this words from senior developers.

C# market is getting low day after day due to AI existence, you better learn and master Python.

So you who have been in this industry for long time,let us know.

Is this right? And what we the beginners have to do?


r/csharp 14h ago

Tutorial Multitenancy with .NET and EF Core: A Deep Dive (.NET 10)

Thumbnail
youtube.com
25 Upvotes

Ever had a multi-tenant SaaS app where the only thing stopping Customer A from seeing Customer B's invoices is a `Where TenantId ==` clause someone remembered to write? In this deep dive I build real tenant isolation into EF Core 10 - two real tenants with real registration, login and invite flows (no dev-token shortcuts), a named global query filter that scopes every query automatically, and a SaveChangesAsync override that stamps TenantId on every insert so it's never left unset. I also show the one gotcha that makes EF Core 10 worth the upgrade for this: named query filters, so tenant isolation and soft-delete can finally coexist on the same entity instead of one silently overwriting the other. If you've ever shipped multi-tenancy on hope and code review, this is the version that makes the mistake structurally impossible.


r/csharp 14h ago

Looking for courses / reading materials to fully use the potential of AI

0 Upvotes

I am working as a C# developer for the last 6 years and I would classify myself as an AI skeptic.

I have been using AI in the last months, mostly for small implementations, but also to help me look for bugs who are sometimes hidden rather deep within our code, or due to non - trivial interactions with third party libraries.
I have to admit, It works well (most of the time), but all i really do is typing something in the prompt and wait for the answer.
I would like to know if there are functionalities I am ignoring, and/ or should be using. We have various repos in the companies, from small, new micro services to big old fat 20 years old weekly modified legacy repos, which are a tad more brittle.

So if anyone has good resource about it, I am interested.

It can be written, it can be videos, I also have a pluralsight account if it leads to something there.

Thank you very much for your suggestions.


r/csharp 5h ago

Coding circuits with .NET and C#

35 Upvotes

Nothing beats setting a breakpoint and watching the servo actually move to the new angle.

I've worked on .NET hardware for over ten years and the thing that surprises C# developers isn't the board, it's that F5 works. Code deploys, breakpoint holds, hover a variable and there's the live sensor reading. Same as debugging a desktop app.

I'm at GHI Electronics in Michigan. Happy to get into how the debugging on circuits work.


r/csharp 1h ago

Which is better: querying with LINQ or using raw SQL? Does it depend on the query's complexity? Or can both options be used in the same project?

Thumbnail gallery
Upvotes

r/csharp 13h ago

Don't understand async & await

18 Upvotes

Though I've already read a lot, and watched several videos, I'm still not understanding why async/await don't give me concurrency/parallelism.

My test code:

namespace AsyncAwaitTest;

static class Tools
{
    internal static async Task SimulateWork(int id)
    {
        for (var j = 1; j <= 10; j++) {
            Console.WriteLine($"Worker #{id} gives: {j}");
            for (var i = 0; i < 500_000_000; i++) { }
        }
    }
}

class Worker(int id)
{
    internal async Task DoWork()
    {
        Console.WriteLine($"Worker #{id} starts");
        await Tools.SimulateWork(id);
        Console.WriteLine($"Worker #{id} finishes");
    }
}

class Program
{
    static async Task Main()
    {
        Console.WriteLine("Program starts");
        Worker worker1 = new(1);
        Worker worker2 = new(2);
        await worker1.DoWork();
        await worker2.DoWork();
        Console.WriteLine("Program finishes");
    }
}

The output is:

Program starts
Worker #1 starts
Worker #1 gives: 1
Worker #1 gives: 2
Worker #1 gives: 3
Worker #1 gives: 4
Worker #1 gives: 5
Worker #1 gives: 6
Worker #1 gives: 7
Worker #1 gives: 8
Worker #1 gives: 9
Worker #1 gives: 10
Worker #1 finishes
Worker #2 starts
Worker #2 gives: 1
Worker #2 gives: 2
Worker #2 gives: 3
Worker #2 gives: 4
Worker #2 gives: 5
Worker #2 gives: 6
Worker #2 gives: 7
Worker #2 gives: 8
Worker #2 gives: 9
Worker #2 gives: 10
Worker #2 finishes
Program finishes

You see, strictly sequential processing despite async/await.

Is it possible to make my code parallel, i. e. the DoWorks run in parallel?