C#

C

C#

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

Join

✅ Creditable usage for `goto`?

I don't think it needs further explanation, basically the goal is to catch any exceptions that might be thrown from inner functions that get called, but to also allow your own exceptions to be thrown when validation fails. Any thoughts? A) ```cs public static int Method()...

Extending EF Core codegen - API Limitation?

I'm currently building a package, EFCore.ModelExtras to let EF track database triggers and functions and migrate them like any other relation. To achieve this, I've extended a bunch of EF's migration generation classes, like ICSharpMigrationOperationGenerator (Interface) (Base) (Mine). This works, and is all well and good for my current purposes, but I realize that this approach of extending the main EF generator, and replacing it in the DI container means that you can only pull this trick once. If someone wanted to use my package, but also use another package that offers a custom migrations generator of the same type I've overridden, they can't. Are there any ways around this without 2 package authors collaborating (e.g. a shared base type or intermediary API), or might I be missing some way to achieve inter-package compatibility with the existing EF Core API?...

✅ Is the YouTuber Bro Code a good source to use for learning C#

I use this playlist https://youtube.com/playlist?list=PLZPZq0r_RZOPNy28FDBys3GVP2LiaIyP_&si=rt3RmC2gOIoFhtlR I was wondering if someone could check to see if there’s any extra things I should learn in C#....

✅ Game modding nightmare Unity + .net 6 + BepinEx

So I'm trying to get hunger and thirst frozen in ASKA, I'm able to get the attributes (63 tied to the Aska player character on joining the world) but I'm unable to make any locks or changes to those values, any locks or changes made result in the hunger and thirst still changing ingame. What is going wrong with this code? If it helps this is the dependencies being used with most of the data being held in SandSailorStudio.dll which I've found with ILSpy...
No description

Invoking ``__fastcall`` function in x86 hosting scenario (.NET 9) by any means possible

During a reversing project of a MSVC 2012 compiled x86 binary I ran into an exported function of the following form that I must invoke:
__fastcall int fn_00a28ba0(int arg1, byte* arg2, int arg3, byte* arg4, int arg5);
__fastcall int fn_00a28ba0(int arg1, byte* arg2, int arg3, byte* arg4, int arg5);
...

✅ i want to learn to make plugins for scp

im interested to learn how to make plugins for scp so i will be very appreciate if someone helps

✅ I'm trying load a .json file in my app but keep getting an error

https://github.com/TheYowzaa/USNPersonnelManager I'm trying to load information from the .json it works just fine when running the app from visual studio but when I move the .exe from the debug file to my desktop it doesn't work. Not sure what else to add....
No description

✅ Share VS settings to my team through git

Hey, is there any way to share some settings of Visual Studio through git with my team? I couldn't find any option for this in VS 2022, and VS 2026 (insider) has the "edit user settings as json" option, but it references a file in the local install directory of VS. The goal is to set code standards and harmonize how it looks as much as possible. I'm looking for settings like the list of rules to run when using Code Cleanup, and whether to run Code Cleanup when saving a file....

✅ Resources for .NET in depth

Hello Everyone, I am a .Net developer with 1.5 YOE mostly working with APIs in ASP.NET Core. Recently I have been feeling like I need to get really deep in the framework and understand what happens under the hood, etc.. Therefore I am writing this Post, if you can share resources that can help or had a similar experience please share it with me Thank you!...

✅ Understanding how to create a controller in ASP.NET.

I am trying to build my ASP.NET controller. I believe that its job is to take the data from the database and package it up and than make it available to the view. After reviewing the tutorial yesterday I discovered that using um dependency injection, I can drop objects into the controller and than it will return that object to the corresponding view. I need to package up all of the questions, answers, topics, and categories. I than need to allow the user to click on the different categories those related categories questions and answers will appear on the webpage. I have never built a controller before. ```Category.cs...

✅ Project ideas for Backend Development

I have been learning .NET core and C# along with SQL Server database and have also worked on a project with this stack. Also I have been exploring Azure Services and its integration with.NET ecosystem and have worked with most of the Azure services required by a developer. But I need to create a project on my own which I can create with this ecosystem. Can you all suggest some project ideas? Thanks...

✅ Is anybody knows how to explain what exactly HttpContext is and its attributes?

In this code: ```cs [Authorize] [HttpPost("RegisterAsBusiness")] public async Task<ActionResult> RegisterAsBusiness(BusinessViewModel businessData)...

✅ Trying to find a way to turn image sequence into video using c#

I am creating a program meant to "autoanimate avatars", right now it makes a sequence of images with green backgrounds and through emgu cv turns them into a mp4. It works well although it could be optimized. The issue is that once I put that mp4 into any editing program, it has a lot of video artifacts due to compression, so I am left with 2 options and I am not sure either is possible from investigating: A) Find a way to write in prores 4444 which can use transparency B) Find a way to export it without compression...

✅ I keep on receiving the same error each time I try run my code on visual studio code.

I have already installed all the necessary prerequisites such as the C# Dev kit and the .NET tools extensions. However, this is the error that I get.
No description

✅ How can I get the path where function saves files?

How can I get the path where this function saves files?```c# public void SaveMaze(SaveFileDialog saveFileDialog, Image image) { string filePath = name + myImageId + ".jpg"; saveFileDialog.Filter = "JPeg Image|.jpg|Bitmap Image|.bmp";...

✅ Outputting to debug console.

You can select "Debug" from the "Show output from" drop-down in the output window. But when I do Debug.WriteLine, it doesn't output it there. I have to select the name of the app I'm debugging from that drop-down instead. How do I output to the Debug console? I have to set up a trace TraceListener send to write to "System.Console.Out". If that matters. Otherwise. I get no output at all....

any good tutorials

I’m okay at coding, but where should I go for more indepth tutorials? I know the basics, but most of the ones I find don’t really cut it. also anything on unty would be great

✅ How to standardize API response formats in C# ?

Hi everyone, I’m working on a C# project and I’ve run into a huge inconsistency problem with my API responses. Here’s what’s happening: I’m using FluentValidation for request validation. If validation fails, I throw a validation exception. I have a global exception handler that catches exceptions and returns ProblemDetails....