C#

C

C#

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

Join

New Dev here

So, i am new to C# development and was wondering if there are any unity plugins i can use to help me better understand what i am doing or make it easier?

configure rate limiting on NGINX or asp.net app itself

currently develop app and deploy into ubuntu server and used NGINX as reverse proxy if i need to apply rate limiting i do in NGINX part or asp.net core app?

Memory on c#

Can somebody explain me how heap memory works there?

Problems using Windows Application Packaging Project for Avalonia

Hello! I keep getting the same error, even when hard coding the path to the Exe file produced by my DesktopRecorderApp project, this is how my 2 projects are configured: https://pastebin.com/5sCCK1FU The error i am getting is the following: "Specified EntryPointExe '' was not found in the project outputs."...

my unity project is being weird

my enemy spawner spawns an enemy with a working follow script but when the original enemy isnt in the hierarcy they just go to 0,0 and break pls help
No description

Determine positions of the longest and shortest word inside of a string list

It's for a school assignment. I tried everything and even CoPilot fails. Th problem is that it prints the longest word, but does not print the shortest word. It also messes up determining the position of the word cause adding them up gives the wrong result. Here is my current code, my naming is in dutch sorry....

✅ add WPF to existing project

I have created the Code and now i want to create the UI for it. When i try to Project->Add->New item... nothing similar like wpf appears. What am i doing wrong?
No description

Have nullable types been changed?

```C# var client = clients.Find(c => c?.id == id); if (client is null) return Button.None; ...

✅ Basic Design Question on Vectors

As a learning project I wanted to implement some basic vector data types. I had made a rudimentary Vector2D and Vector3D class, and was making dynamically sized Vector class when I had this question. Would it be possible to have a statically sized vector class that can work with multiple sizes? For example, I could create an instance of VectorN with 2 dimensions and an instance of VectorN with 5 dimensions and if I tried to add them it would error in compile time. With my very introductory knowledge of C# my best guess is with attributes and reflection, but I'm not sure and thought I'd ask....

Check that two function signatures are equal at compile-time

I have two C# methods, which we'll call method A and B. I know the exact signature of A, but not of B. I want to write some C# code that, at compile time, ensures that A and B have the same signature. However, the equality should be somewhat loose, for example if B is an instance method with no parameters and no return value, and A is a method with as sole parameter the class B resides in and no return value, they should be equal. Is this possible?...

Copy PackageReferences to output directory

I have a netstandard2.1 classlib project, and I noticed that PackageReferences are not copied to the output directory. I have tried Private="true" and even CopyToOutputDirectory="always", but both had no effect. Is there any way to configure msbuild to copy packages to the output directory?...

how do i learn .net

so i just started this roadmap https://roadmap.sh/aspnet-coreand so far , ive watched freecode camp's 8 hours video on c# fandementals https://www.youtube.com/watch?v=YrtFtdTTfv0 and inside the road map , specifically this part i have as a pic i have no idea what to learn in it like learn what .net is or go into details or what and what sources are there...
No description

gRPC Windows Service

Have a requirement to run a gRPC server over named pipes as a windows service. Everything I see and have done before for windows services is using the WorkerService project template, however, i see all the gRPC server setups using a different template (one with WebApplication.CreateBuilder). Ideally the same service could be used to receive RPC calls from a webserver as well as hosting its own local server. Anyone have experience doing this and could provide a little guidance? Thank you in advan...

Am i on a proper way to learn AspNetCore?

I've read the AspNetCore in .Net 9.0 docs, the Fundamentals part, "overview" to "send the http request" (expect AOT catalog) for one time, i am still confused about the class like XXXExtentions or XXXResults. So i went to the real project (https://github.com/davidfowl/TodoApp?tab=readme-ov-file), to see if it can give me some inspiration on these classes and how it works and so on. Indeed, i truly learned some, but then filled with more doubts. Cause there are so many functions and classes that i haven't encountered yet. And it is anxious to deep into one function to another, And there are also like ClaimsXXX classes. Maybe i should not to deepen into the AspNetCore package as first. But i need to understand the relationship between these files and the relation in these classes to have an overview of what the real app looks like, to speed up my learning of AspNetCore. I truly want to make one dashboard app of my own, but maybe it will take longer time to get. I still question that am i doing the right way to reinforce my comprehension of AspNetCore through a project? Any advice to make the process quicker with the AspNetCore? Guys, have you been through the same when you came with AspNetCore at a very start? :catHeyHello:...

C# exercises

Someone from this server has sent me link to github with c# exercises with every level, but I’ve lost it. Could someone send me something like this to practise?

VSCode Level Editor Extension

I'm working in Monogame and I thought that it would be useful to use a VSCode extension as a level editor. That way I wouldn't have to include the level editor in the project (which means hotreloading) or make a seperate one just for level editing functionality. There'd likely be one cs file per class and classes with a certain attribute can be placed down in the level. Then, when the game starts, it plays the level for real (I'd probably store it in an xml file or something.) Since I want to be able to access the properties and maybe even run construction-based functionality in the level editor, I'd obviously have to have a C# parser or something since extensions are written in Javascript. Would also be cool if I could be sent some resources. I've already read the beginner documentation....

Which AI assistant do you use the most for software engineering?

I am thinking about getting a paid version of AI assistant, but I am not sure which one should I take. So if we are looking only from software engineering context, which AI would you recommend me the most? I was mainly deciding between ChatGPT and Claude, but there are still others.....

Editor randomly crashes after pausing the scene?

Hey, I have a really weird error in Unity. I have a gameobject with this script attached to it https://pastecode.io/s/fh2e2d3v If I don't use any of it's methods everything is fine, but when I use SimulateLogin and then pause or stop the scene Unity just crashes. No errors in the console, only that bug report window. Any ideas what might be causing it?...

Multiple Change Notification from Microsoft Graph

I am trying to receive change notifications from Microsoft Graph whenever an event is updated (created, deleted, or updated). I have successfully managed to create subscriptions. The URL that receives the notifications is of an Azure Function. However, whenever I create or delete an event, the Graph sends multiple notifications for one specific change. As mentioned in the documentation https://learn.microsoft.com/en-us/graph/webhooks, I am sending back 202-Accepted status code to the Graph as soon as I receive the change notification....
Next