Questions tagged [c#]
C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform. Use this tag for questions related to C#. In case a specific version of the framework is used, you could also include that tag; for instance .net-2.0.
9,970 questions
4
votes
2
answers
665
views
A simple class that takes in a byte array, computes a width and height to represent and hide the initial byte array inside of a bitmap
This simple class allows us to hide a byte[] inside the Scan0 of a Bitmap's ...
3
votes
1
answer
143
views
Simple Random Password Generator in C# Updated
This is an update to my Simple Random Password Generator. It has been renamed to SecurePasswordGenerator and uses ...
5
votes
1
answer
190
views
Simple random password generator in c#
A simple random password generator in C#. Looking for any improvements around speed or design. Any char[] can be passed to choose random chars from. The array I ...
2
votes
1
answer
80
views
C# .NET 9 API for managing a personal investment portfolio
I've written a C# API using .NET 9 with the goal of managing a personal investment portfolio – that means,
adding funds
adding or removing transactions (for ETFs, ETCs, and usual funds)
retrieving ...
4
votes
1
answer
187
views
Maintaining a memory-barrier with an expression-bodied member
I have a C# class with a number of properties that are read by and set by multiple threads. I use a simple lock when getting and setting them in order to have a full-fence memory barrier, so member ...
4
votes
1
answer
368
views
Tic Tac Toe Game app design - ways to design or segregate too much logic from UI
I wanted to check my system design and/or object oriented design skills. I started with this Tic Tac Toe WinForms Desktop program. The user couldn't input characters other than O , X . Both players of ...
0
votes
0
answers
105
views
Negamax Implementation for Unity Hnefatafl Game
I've been banging my head against the AI for a Hnefatafl game I'm making (pronounced NEF-a-taf-full, otherwise known as Tablut) for quite a while now. It's caused me no end of frustration, though I ...
0
votes
3
answers
222
views
C# quicksort implementation (LeetCode Sort an Array)
I implemented quick sort after merge sort as part of LeetCode question for sorting an array. The solution code can be found at https://leetcode.com/problems/sort-an-array/solutions/7180269/i-...
7
votes
1
answer
134
views
Player controlled dungeon creation system
I'm making a game with a system inspired by the PSP Game Dungeon Dungeon maker 2 the hidden war: Visual Reference. I have everything set up but I feel there are ways to make the code more simple and ...
4
votes
1
answer
110
views
Style taking applying control's DataContext property as converter input
In my Avalonia app using the MVVM Community Toolkit, I want to have a number of buttons in multiple user controls in my application to have as their content a ...
2
votes
1
answer
160
views
Blazor web app using .NET 9: SQLDbSettings Code Optimization
I am developing a Blazor web app using C# .NET 9 in Visual Studio Code. I am using SQL Server 2017. This project is intended for internal company use.
In the ...
4
votes
3
answers
153
views
Generic lock class with a timeout and EventHandlers
I've created a generic lock class with a timeout and EventHandlers. I'm asking here for any improvements in performance or ...
8
votes
2
answers
1k
views
C# wait for a state change without blocking
I have a class that manages an HttpClient to make API requests to a third party service. The service requires being logged in to make requests. When logged in, a ...
2
votes
0
answers
78
views
Generic UnitOfWork implementation with Dapper. (Updated)
Here's my attempt to implement the suggested corrections I received in my previous post. Since System.Data.IDbTransaction doesn't support ...
1
vote
1
answer
97
views
Generic UnitOfWork implementation (Dapper)
I'm creating a three layered Visual Studio template solution that I'll be using as a starting point for all ASP.NET projects.
The layers are Presentation, Application and Infrastructure. ...