C#

C

C#

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

Join

Is it possible to use Reflection to replace a static readonly field without the static constructor?

So, say for example I have a class like the following: ```csharp class Test { static readonly string Value = throw new NotImplementedException();...

Help Needed: Implementing Face Recognizer in C# Windows Forms App with Emgu CV

Hi everyone, I'm currently working on a face recognition application in C# using Windows Forms and Emgu CV. The app successfully detects faces and allows me to capture and save images. But I'm struggling with implementing a face recognizer that can identify a person in the live feed based on previously saved images. Could anyone guide me on how to implement a recognizer that can load the saved images and compare them with the live feed? Any help with code examples or a step-by-step explanation would be greatly appreciated. ...
No description

Compiler Error CS1503 Help

Hello 😄 I am relatively new to Csharp and am working on a project which is supposed to generate checkboxes when it locates a client is open yada yada yada. I am using a different source as an example and even when copying 1:1 I get this error and am very confused on how to fix it! ...
No description

VSC & C# newbie, cannot get file to work for the life of me

Hello there, this is embarrassing to ask, however I am having issues loading and using C# in VSC. I am familiar with other languages and using them in VSC, however I cannot get code I have written to run properly. I have the code, I just need them translated into VSC so I can download them. IF anyone can help me, and would be willing to translate the text files into VSC for me, that would be amazing.

✅ impossible error

so i'm using a Stack<Move> for my chess board's move history. it somehow managed to raise an out-of-bounds error with the line being directly correlated to this line:
moveHistory.Push(move); // Index was outside the bounds of the array.
moveHistory.Push(move); // Index was outside the bounds of the array.
...

I need help (3D Animations).

Anyone who can make 3D Animations in Blender,please dm me!

What should i choose?

Im a beginner and im trying to make simple calculator should i go with WPF Application or Windows Form App when will i ever need to use either one in a certain situation like when will my boss ask me to choose a certain one and why?

Is an input library a good project for the portfolio?

I’m creating my own well-written library for getting different kinds of user input, and I’m curious if it’s a good project for my future portfolio.

MemoryMappedFile not working under global

I am trying to use memorymappedfile for communication between a service and a program and it keeps saying file not found when I try to use OpenExisting.

WinUI 3 App.g.i.cs Autogen File breaking?

I am trying to create a WinUI 3 Application and I added some code and now the autogenerated file App.g.i.cs throws a break. Here is the code that breaks it, and e, doesnt have a stack trace App.g.i.cs ```cs #if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION...
No description

Does this work the way I think it does?

I can set this to linux, develop everything on windows and then just later use it to host the api on linux?
No description

✅ Microsoft Identity, ASP.NET API and MVC

So i'm working on a School project and i'm going beyond what is required. I've got two projects. - an ASP.NET API project and an MVC project. I've set up a full Account experience that makes use of CRUD operations on the API side that i've tested through Swagger and it works perfectly fine. I cannot however for the life of me get the MVC project to work with the Login server....

.NET 8 SPA Identity

Hi, I try to use SPA Identity in .NET 8 - https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity-api-authorization?view=aspnetcore-8.0#test-registration it's works fine, but I need two things: 1) change e-mail texts - framework sending some standart text, but i need send my own html template 2) after registration I need start some backgroud proccess ...

VS code says my c# code is unsupported

Hi! Im new to c# and is still learning the basics and i have zero knowledge of how to set up vs code, i followed someone's tutorial on youtube and ended up with a vs code that tells me all my codes are unsupported. Help 😭

Need help with Wix Tool V4

Hello, I am trying to unzip a file using CustomAction but log file gives error Error extracting zip file: Could not load file or assembly 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified....

null check raising errors

i come from python and my first interpretation was that they can work like decorators, but that's clearly not the case. my question is how do i modify class data with an attribute? like how in python you can decorate a class like this: ```py...

✅ Inconsistent accessibility error - no idea where this came from

Full error:
Inconsistent accessibility: parameter type 'Argument[]' is less accessible than method 'CLI.ArgParser(string[], Argument[])'
Inconsistent accessibility: parameter type 'Argument[]' is less accessible than method 'CLI.ArgParser(string[], Argument[])'
...

Return Value on Entity Modification

Hi everyone, I'm creating a class library that contains my entity framework models and surrounding business logic for my project. I am creating a method for modifying one property of my entity. I am wondering if it is best practice to have this method return the entire object, a bool for success/fail, the changed value, or nothing. My thinking is that since the method is being passed a reference to the entity stored in the database, I shouldn't have to return the full entity as the change has been saved, but I just don't know what sort of standard to apply in my code and if it will have any negative cosequences in the future of the codebase....

Install SkiaSharp

I'm completely new to C#. I'm trying to install a package but can't figure out how. What is going wrong? ``` $ nuget install SkiaSharp Feeds used: ...

✅ while loop on cpu

is there a type of while loop that doesn't hammer the cpu with checks? like when i type a character, THATS when it updates, instead of as many times as it possibly can, because it slows down my pc and i dont get these issues with other CLI tools (eg. python repl)