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
3
votes
3
answers
216
views
concatenate string, with different first and last iteration
Good day. My code works but I think there is a better way to do this. Like string pattern or string manipulation. I'm not yet familiar with both terms.
The goal is to get "=A1-A2-B3-D4-WHATEVER ...
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
3
answers
696
views
Algorithm to find sequential ID gaps in List<long>
I had to develop an algorithm that will find gap between sequential Ids within a List<long>.
For example as input we had the following ...
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 ...
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 ...
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 ...
13
votes
2
answers
6k
views
Convert WKT representations of geometries into GeoJson
I am working on a class library in C# to convert WKT to GeoJson. I am getting shapes in WKT out of MSSQL. A lot of the shapes ...
6
votes
3
answers
635
views
LISP-like list class
So, here's my code:
...
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
117
views
Simple async lock using key in .NET
The task is to make a simple LockProvider that will lock a thread by identifier.
Basic requirements:
Simple call via using block.
Support for CancelationToken to get out of waiting without exceptions....
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 ...
6
votes
1
answer
228
views
Four layer encryption implementation
Would anyone care to elaborate my approach to a multi-layer encryption scheme. It encrypts with four layers and gets shuffled with a random key as well. This is used for a password vault application.
<...
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-...
2
votes
1
answer
655
views
Dictionary iteration with many loops
I have a dictionary iteration that uses a for-each comparisment in order to find multiple equalities in a string (fileline).
...