C#

C

C#

We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join

Is it necessary to setup validation constraints at the api level and database level?

I'm setting up a minimal api and just started to use FluentValidation. Should I also setup validation constraints at the database level as well?

Improving performance / caching

Hello, Im coming to an end with my database software. I filled the database with around 150 rows, but now I got the problem that performance is really trash with everything it does, even if it only does single row querys. So I thought maybe it´s possible to create a cache which stores all data once they are loaded which then is being used by all the other methods making a query. This is the code where all aircrafts are being collected, at the moment the data is loaded asynchron to not block the UI. How can I build such a cache with is used by every method?...

How to target .net standard in visual studio

when i create new project, the target framework that i can choose is only .net framework, there is no .net standard. I installed .net core 3 in my pc and .net standard still not shown, then i installed .net core 3.1 runtime in visual studio and .net standard still not shown in target framework. How do i target .net standard ??

Help with error

what is this error and how to fix it
No description

How to start coding C# in vs code??

ive already installed c# dev kit and .net from website ad from .net install tool but when i try to create a new project this window pops out. and when i try to check the version with dotnet --version it has a problem (screenshots) please what do i do
No description

unity character clips into floor and cant walk properly

unity character clips into floor and cant walk properly

✅ cant get dotnet sdk recognized

no matter what i try im stuck here recognizes runtimes but not sdks
No description

Studying singly linked lists and need help understanding pointer functionality

I would love some help understanding something in the following leetcode problem Merge Two Sorted Lists: ```csharp void Main() {...

This is my code how do I convert the Object of Basewords into a string?

namespace ConsoleApp1 { class Program { static void Main(string[] args)...

✅ Aspnet runtime not found when running, but present in dotnet --info (linux)

I'm having issues trying to run Aspnet applications on Linux Mint. Running dotnet --info shows both the dotnet and aspnet runtimes, but when I try to run the aspnet application I get an error stating that the framework is not found. I've since reinstalled dotnet manually instead of with the package manager and checked that the files are all present in the home directory. The app is using dotnet 7 with dotnet 8 installed, but this happens regardless of what dotnet version I use. I'd really app...
No description

✅ Mac is not supported by Visual Studio anymore, There is not download link for Mac user anymore,

I have checked the Microsoft page. VS has not been suported for Mac user since 31 August 2024, Rider is not free, there is only option for me VS code. I am just trying to create environment for basic C# code implementation to see the difference between Java, I am a new learner, I have cloned this git repo https://github.com/derekbanas/C-Sharp-Course.git which contains pretty good c# fundamental examples but I can not run any test I want to run C# Code / Program.cs file but I can not run it , what I am missing...
No description

✅ Hey IDK how to use NetSpell

This is probably really simple thing to do but IDK the keywords, and functions and methods to Netspell package and I can't find them on internet. I already installed the NetSpell package.

Need help with AspNetCore and GUID.

Well I have got the following code for my register method in my webapi (Shown on first image. It is pretty simple). I am running my xUnit test for this method (everything is good) but it seems that I can't access my user.Id normally (I am returning it via "return Ok(user.Id);" line). Somehow debugger shows me that I have got two Id properties, one is actual Id and another just filled with zeros (shown on second photo). I would be grateful if someone explains me what is the problem with them and...
No description

✅ .NET workloads not found when searching

Hello. I'm trying to install the iOS workload using the dotnet CLI. However, when I go to search for the iOS workload, I cannot find it. It happened the same with when I tried to install the android workload. That issue was fixed by just updating dotnet. However, this time it isn't fixed even after updating to the newer version. Any ideas that could be causing this? OS: Arch Linux x64 .NET SDK version: 8.0.402 Workload version: 8.0.402.1...

What the best way to handle splines/rail grinding in Unity?

Hi everyone! I'm working on a 3D sonic physics engine and I want to integrate splines with a player controller, but most of the tutorials I’ve found only show how to use splines for creating mesh paths or moving prop objects along a path using spline_animate. I'm looking to implement more complex mechanics like: Rail grinding: The player can move along a spline and jump off at any point, with speed carrying over. Auto-running sections: The player should be able to transition into a spline-based path, but their current speed should carry over instead of being reset....

What's the correct way to handle state in a SignalR Hub?

I am going to implement a SignalR hub which will be connected to by a client application. The purpose of this being SignalR and not just HTTP requests is so that I can send messages from the server back to the client at any point without the need for something like port forwarding, just ad-hoc, and I will also use the connection to request general data too, so I don't need more than one connection to communicate data either direction. I would like to authenticate the client with an API key when it connects, or allow it to connect unauthenticated so I can pop it up on my control panel and assign it a new API key and identity remotely (remote provisioning, essentially) What would the correct way to do this be? I understand that sessions are not available as a result of "duplex messaging" which makes perfect sense, so my other idea was to do this with a scoped service to hold some state data for the connection, but as far as I can tell, the DI scope is not guaranteed especially if the hub is connected via HTTP polling instead of WS....

C# winforms need help to do this..

I have a typing software I have virtual keyboard the expected key get's highlighted when it's needed to be pressed but I want to achieve one thing which is I want a virtual hand that is showing each finger placed over the default hand keys and then when the highlighting of needed keys by placing the hand finger on it I hope you got what I mean

✅ Storing user related data when using an auth provider

Hello, When using an auth provider, all the user data, like ID, email, etc. is stored and managed by the provider. Regarding that, do I need to store the user data in my SQL database and make relation based on that? Or would it be better to simply add an extra userId column to tables where needed and leave it be? (without any relationship)...