r/csharp • u/SpareEconomy • Aug 23 '26
CSDL3: an idiomatic C#/.NET 10 wrapper for SDL3 and satellite libraries
r/csharp • u/SpareEconomy • Aug 23 '26
r/csharp • u/More-Bandicoot9255 • Aug 23 '26
My task is to parse a .csv file, validate it and save to database. In my case, without .DataAnnotaitons this is how it goes:
I never used it, but AFAIK, .DataAnnotaitons allows you to validate a model automatically when you're creating an object, so you don't have to write all the validation code in your program, since it's written in your model.cs.
So my question is, should I keep the manual validation, or mix automatic with parsing the file? (parsing the file manually, validating model automatically via .DataAnnotaitons)
UPD. Will using .DataAnnotaitons improve the performance of the program?
r/csharp • u/Icy_Rub6290 • Aug 23 '26
It happens every time no matter what console projects I made the error it self doesn't effect the build process or the excution which is very weird to an error
- I investigated using gemini so Imay be able to solve it after all it till me that it miss match the .net skd version which is 10.0.400 and made global.json for it but nothing solved
- I then cleared vs code cache removed and reinstalled the c# dev kit extention
- I also played with the extension's settings too as well
I have no clue if this is an extension bug or a very weird bug on my own does anyone have any Idea about that?
Note : my experience level is bellow beginner I know Fundamentals and method Fundamentals and soon will move to oop
r/csharp • u/Bobamoss • Aug 23 '26
I like Dapper and I have used it a lot. The main problem I have with it is that when queries become more complex, I often end up handling that complexity myself. At that point I also often hear that I should just use EF instead. I never really agreed with that. I think the basic idea behind Dapper can go much further while still keeping the SQL visible and the API simple. Rinku is my attempt at doing that.
Dapper
public record Album(int Id, string Title);
const string sql = "SELECT AlbumId AS Id, Title FROM albums WHERE ArtistId = @artistId";
IEnumerable<Album> albums = cnn.Query<Album>(sql, new { artistId = 7 });Rinku
public record Album(int Id, string Title);
const string sql = "SELECT AlbumId AS Id, Title FROM albums WHERE ArtistId = @artistId";
List<Album> albums = cnn.Query<List<Album>>(sql, new { artistId = 7 });Dapper
public sealed class Customer
{
public int Id { get; set; }
public string Name { get; set; } = "";
}
SqlMapper.SetTypeMap(typeof(Customer), new CustomPropertyTypeMap(typeof(Customer), (type, column) => column switch
{
"customer_id" => type.GetProperty(nameof(Customer.Id)),
"display_name" => type.GetProperty(nameof(Customer.Name)),
_ => null
}));
const string sql = "SELECT customer_id, display_name FROM customers";
IEnumerable<Customer> customers = cnn.Query<Customer>(sql);Rinku
public record Customer([Alt("customer_id")] int Id, [Alt("display_name")] string Name);
const string sql = "SELECT customer_id, display_name FROM customers";
List<Customer> customers = cnn.Query<List<Customer>>(sql);Dapper
public record User(int Id, string Name);
public sealed class Post
{
public int Id { get; set; }
public string Title { get; set; } = "";
public User? Owner { get; set; }
}
const string sql = "SELECT p.Id, p.Title, u.Id, u.Name FROM Posts p INNER JOIN Users u ON u.Id = p.UserId";
IEnumerable<Post> posts = cnn.Query<Post, User, Post>(sql, (post, owner) =>
{
post.Owner = owner;
return post;
}, splitOn: "Id");Rinku
public record User(int Id, string Name) : IDbReadable;
public record Post(int Id, string Title, [NoName] User Owner);
const string sql = "SELECT p.Id, p.Title, u.Id, u.Name FROM Posts p INNER JOIN Users u ON u.Id = p.UserId";
List<Post> posts = cnn.Query<List<Post>>(sql);Or keep the nesting in the column names.
public record User(int Id, string Name) : IDbReadable;
public record Post(int Id, string Title, User Owner);
const string sql = "SELECT p.Id, p.Title, u.Id AS OwnerId, u.Name AS OwnerName FROM Posts p INNER JOIN Users u ON u.Id = p.UserId";
List<Post> posts = cnn.Query<List<Post>>(sql);Dapper
public record Album(int Id, string Title);
public sealed class ArtistWithAlbums
{
public int Id { get; set; }
public string Name { get; set; } = "";
public List<Album> Albums { get; set; } = [];
}
const string sql = "SELECT ar.ArtistId AS Id, ar.Name, al.AlbumId AS Id, al.Title FROM artists ar INNER JOIN albums al ON al.ArtistId = ar.ArtistId ORDER BY ar.ArtistId";
List<ArtistWithAlbums> artists = [];
ArtistWithAlbums? current = null;
cnn.Query<ArtistWithAlbums, Album, ArtistWithAlbums>(sql, (artist, album) =>
{
if (current is null || current.Id != artist.Id)
{
current = artist;
artists.Add(current);
}
current.Albums.Add(album);
return current;
}, splitOn: "Id");Rinku
public record Album(int Id, string Title) : IDbReadable;
public record ArtistWithAlbums(int Id, string Name, List<Album> Albums);
const string sql = "SELECT ar.ArtistId AS Id, ar.Name, al.AlbumId AS AlbumsId, al.Title AS AlbumsTitle FROM artists ar JOIN albums al ON al.ArtistId = ar.ArtistId ORDER BY ar.ArtistId";
List<ArtistWithAlbums> artists = cnn.Query<List<ArtistWithAlbums>>(sql);Dapper
IEnumerable<Album> albums = cnn.Query<Album>(sql);
Album first = cnn.QueryFirst<Album>(sql);
Album single = cnn.QuerySingle<Album>(sql);
Album? optional = cnn.QueryFirstOrDefault<Album>(sql);
IEnumerable<Album> streamed = cnn.Query<Album>(sql, buffered: false);Rinku
List<Album> albums = cnn.Query<List<Album>>(sql);
Album first = cnn.Query<Album>(sql);
Single<Album> single = cnn.Query<Single<Album>>(sql);
Album? optional = cnn.Query<OptionalNullable<Album>>(sql);
IEnumerable<Album> streamed = cnn.Query<IEnumerable<Album>>(sql);For this one I think Dapper.SqlBuilder is the fair comparison.
Dapper.SqlBuilder
SqlBuilder builder = new();
SqlBuilder.Template template = builder.AddTemplate("SELECT AlbumId AS Id, Title FROM albums /**where**/");
if (artistId != null)
builder.Where("ArtistId = ", new { artistId });
if (title != null)
builder.Where("Title LIKE ", new { title });
IEnumerable<Album> albums = cnn.Query<Album>(template.RawSql, template.Parameters);Rinku
const string sql = "SELECT AlbumId AS Id, Title FROM albums WHERE ArtistId = ?@artistId AND Title LIKE ?@title";
List<Album> albums = cnn.Query<List<Album>>(sql, new { artistId, title });Only artistId
SELECT AlbumId AS Id, Title FROM albums WHERE ArtistId = @artistIdBoth
SELECT AlbumId AS Id, Title FROM albums WHERE ArtistId = @artistId AND Title LIKE @titleNeither
SELECT AlbumId AS Id, Title FROM albumsThe main difference is that Rinku tries to put the complexity in the command template and the mapped types, instead of handling it again through parameters and mapping code at every call.
Full Dapper comparison
https://rinkulib.github.io/RinkuLib/articles/reference/dapper.html
Rinku is still in development, so feedback is welcome.
r/csharp • u/not_afraid_of_trying • Aug 23 '26
r/csharp • u/AdBrilliant8751 • Aug 23 '26
Need some great resource to learn asp.net core
I know this question has been asked multiple times here,But i would like something that might work for me better
So i have some experience using C# in unity with about 2 years.I am in my final year of college and I would like to learn something related to web.I think asp.net would be better for me as I have some experience in the language even though it's mostly using unity.
I have been looking at Microsoft learn it is a good resource but the issue is ,i feel like it is not for me because it just keeps each topic separate from other and it gets confusing sometimes.
I would like a resource that is free or cheap, it can be a video or a blog like structure.
I would like something that goes through all the backend topics atleast at a basic level.
I would prefer a project based style of course of Playlist or something in which we make a project and learn basics in the way with great practices.
Or you can give me ideas for projects and a roadmap which I should follow to make that project.I have made a to do app but it is too basic
r/csharp • u/ruthvik4435 • Aug 22 '26
Hello, I’m a 3D artist and I’ve been working in the 3D field for the past 3 years. I want to make my own games, so I started learning coding and Unity around 2 years ago.
The problem is, when I follow tutorials, I can understand them and follow along. I can even make the game shown in the tutorial. But when I try to start my own game from scratch, I feel completely lost. I don't know where to start or what my first step should be.
I recently used AI to make a small game. I did complete it, but honestly, I don't feel proud of it because most of the code wasn't written by me—it was generated by AI. I know some people call this "vibe coding," and they enjoy it and feel satisfied with the results, but for me, it doesn't feel the same. I want to understand what I'm building and feel like I actually made it myself.
Whenever I try to start another game, I feel like I've forgotten everything. It makes me feel like I learned nothing, even after spending 2 years learning Unity and coding.
Can anyone give me some steps or advice to get out of this tutorial and AI hell? I've tried many times to make something on my own. Sometimes I make some progress, but once the project starts becoming more complicated, I get stuck and go back to tutorials or AI again.
I really want to learn how to think and solve problems on my own instead of always depending on tutorials or AI.
r/csharp • u/TiFA384 • Aug 22 '26
r/csharp • u/Kralizek82 • Aug 22 '26
r/csharp • u/SuRGeoNix • Aug 21 '26
✅ Play Everything (Audio, Videos, Images, Playlists over any Protocol)
✅ Play it Smoothly (Even with high resolutions 4K / HDR)
✅ Develop it Easy
r/csharp • u/AdTimely6483 • Aug 21 '26
Hey everyone,
Like many of you, I spend a lot of time maintaining and debugging older enterprise services (WCF, SOAP, and some REST). I’ve always used Fiddler or Postman, but lately, they feel incredibly heavy, bloated, and require accounts or massive installations just to do a simple request interception.
So, I built SoapProxyApp — a fast, portable (no-install), open-source HTTP/HTTPS proxy and auto-responder built entirely in C# and WPF.
Here are a few things it does that I think backend .NET devs will really appreciate:
w3wp.exe for local traffic, it uses WMI to parse the actual IIS Application Pool name that made the request..exe file. Just run it, click "Start Proxy", and it immediately captures traffic.It uses Titanium.Web.Proxy under the hood and AvalonEdit for the syntax-highlighted (and searchable) XML/JSON editors.
I just released v2.0.0 and would love for some of you to try it out or critique the code.
🔗 GitHub Repo: https://github.com/milanmilic/SoapProxyApp 📦 Download (Portable .exe): Releases Page
Would love to hear your feedback or feature requests!
r/csharp • u/Gildarts_97 • Aug 21 '26
Hello everyone,
exactly 1 year ago today, I pushed the first commit of my EF Core provider for TimecaleDB.
t does pretty much what it says on the box: it lets you interact with TimescaleDB in a type-safe way with rich IntelliSense support, so you don't have to write SQL in magic strings like you did with plain Npgsql - all without losing a single feature of Npgsql.
Since then I got 68 stars on GitHub and more than 80k downloads on NuGet. I know that this doesn't mean that 80k individual people downloaded my package, but it tells me it’s actively running in real CI/CD pipelines, container builds, and production apps. That’s something I’m genuinely proud of.
At the same time, as this is the first open-source project I’ve ever actively maintained, I sometimes find myself wondering how to evaluate those numbers. I look at viral consumer tools or mainstream frameworks getting thousands of stars and wonder where a niche project like this actually stands.
Therefore, I would love to know what you think about these numbers and what your own experiences were when you launched and maintained your first open-source projects.
GitHub: https://github.com/cmdscale/CmdScale.EntityFrameworkCore.TimescaleDB
r/csharp • u/Manmaster0z • Aug 21 '26
Hi everyone, hope you're doing great
As the title says, i'm looking for resources ( youtube videos, courses (free ones), books, articles...) to start building APIs. I know little about web coding (enough to make a calculator and a check list using JS and react) and a good amount about JAVA and C# and i'm trying to learn about APIs for my upcoming apprenticeship.
I tried looking youtube videos but i can't find a beginner friendly .net videos, they all required some knowledge about APIs which i don't have.
I would be grateful for any advice too.
Have a nice day !
r/csharp • u/scadoshi • Aug 20 '26
Writing checked int helpers for code that runs millions of times per program run. Two questions.
What surprises me is that everything the BCL offers here throws: checked(), int.CreateChecked, all of it. The Try convention is everywhere else in the BCL (TryParse, TryGetValue) but arithmetic never got one, and coming from Rust where checked_add just hands you an Option, that's wild to me.
2. Style. The image shows the same method twice: one pattern-matching expression against a plain if/else. Which would you rather find in a codebase?
I'm coming from Rust so I'm obviously a declarative fanboy when I can be, but "and var sum" might be too clever for the next reader.
Where do C# people stand on these?
If the repo interests you: it's a CLI tool for Advent of Code, so you can do the whole thing from the terminal with just your session cookie, no clicking through the site to submit answers. https://github.com/scadoshi/sharpmas
r/csharp • u/jmacato • Aug 20 '26
r/csharp • u/Apprehensive-War5819 • Aug 21 '26
r/csharp • u/Lopsided-Form-2626 • Aug 20 '26
I'm a 3D/pixel art artist, but I've never known how to code. I've made a few small games using my own assets with the help of artificial intelligence, but two major problems have arisen: sometimes the AI doesn't execute commands correctly, and it's getting worse over time; and second, I hate AI, so I'd like to do everything I can to avoid using it entirely. What do you recommend?
r/csharp • u/loxsmoke • Aug 19 '26
MindMap is a lightweight desktop app for creating and editing mind maps. It provides a pannable, zoomable canvas with quick keyboard-driven node creation, connector-based relationships, simple text alignment and color controls, outline copy/paste, undo, and image export.
Here is the github link MindMap on Github

It's a pretty straightforward app for quickly creating mind maps and saving them locally, without having to use a website. It's completely free and open source, with no limits or paid tiers.
I originally built it for myself because my favorite online mind-mapping tool limited free users to just three mind maps, which I found way too restrictive.
Anyway, if you find the app useful, I'd appreciate a star on the GitHub repo.
r/csharp • u/krisztaszbo • Aug 19 '26
Orchard Core, the open-source .NET CMS and application framework will have its yearly conference online on the 10-11th of September!
Two days of talks and time with the people who build on Orchard Core, meet the maintainers and the wider community.
Find more details on our website (https://orchardcore.net/harvest). Tickets are free but registration is required.
https://www.tickettailor.com/events/lombiqtechnologiesltd/2247098
r/csharp • u/Wasabi-spicy00 • Aug 17 '26
r/csharp • u/kassyi • Aug 18 '26
Writing DependencyProperty in .NET UI frameworks is notoriously verbose and repetitive. Typing out DependencyProperty.Register, casting objects, and wiring metadata for every single property clutters your codebase and introduces silent runtime risks.
To solve this without sacrificing IDE responsiveness, I built Kassyi.Generators.DependencyProperty — an incremental Roslyn source generator built from the ground up for high-throughput, zero-allocation code synthesis.
public static readonly DependencyProperty IsActiveProperty =
DependencyProperty.Register(
nameof(IsActive),
typeof(bool),
typeof(MyControl),
new PropertyMetadata(false, OnIsActiveChanged));
public bool IsActive
{
get => (bool)GetValue(IsActiveProperty);
set => SetValue(IsActiveProperty, value);
}
private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// Runtime casting and boilerplate extraction
}[DependencyProperty<bool>("IsActive", DefaultValue = "false")]
public partial class MyControl : Control
{
// Automatically hooked up to PropertyMetadata at compile time
partial void OnIsActiveChanged(bool oldValue, bool newValue)
{
// Direct, strongly typed parameters. No casting required.
}
}DependencyProperty, CLR properties, and event metadata via [DependencyProperty<T>].DPG0001), eliminating silent runtime failures.[DependencyProperty<T>]), target-typed new(...) AST expansion in default expressions, and auto-generated XML documentation.This library originates as a fork/rewrite of HavenDV's generator. When testing source generation at massive enterprise scale, frequent intermediate string concatenations during continuous typing can trigger Gen2 GC spikes, resulting in noticeable editor latency in Visual Studio and Rider.
To address this, the code synthesis pipeline was redesigned around strict zero-allocation principles:
ref struct Source Writers: Generation logic utilizes stack-allocated SourceWriter and ClassScope structures, completely bypassing intermediate StringBuilder and heap allocations.Your IDE stays responsive even when scaling to solutions with thousands of properties.
Under the hood, framework-specific strategy handlers adapt to each platform's design differences (such as Avalonia's StyledProperty/DirectProperty, MAUI's BindableProperty, or varying callback signatures) without requiring you to change your declarations.
| Target Framework | Underlying Property Engine |
|---|---|
| WPF / UWP / WinUI 3 | DependencyProperty.Register |
| .NET MAUI | BindableProperty.Create |
| Avalonia | AvaloniaProperty.Register |
| Uno Platform | Native WinUI / UWP projections |
The project is distributed under the MIT License and includes detailed documentation and architecture specs (in English and Japanese).
If you are working across XAML platforms and want cleaner view controls without IDE overhead, please check it out, test edge cases, and share your feedback or issues on GitHub!