C#

C

C#

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

Join

Process not spawning as a child

My ffmpeg process spawns, but it's not as a child of the main console application ```c# var process = new Process(); process.StartInfo.FileName = "ffmpeg"; process.StartInfo.Arguments = "";...

Cancel long running task/method

Hi, i have a question: I have a WPF app and want to call the method solver.Solve(); that could take some time but i have not "control" over the method. How can i put that onto another thread that is also cancelable? I tried this but it seems that the cancellationToken is only checked on entering this Task.Run: ```cs await Task.Run(() => {
return solver.Solve();...

✅ Need someone that can make a gui for me without code

Need someone that can make a gui for me without code

How did you guys learn C# and stayed motivated doing it?

Hey guys, im currently in an IT School and i will learn Java through it in the near future. But another Goal of mine is to learn C#, im always trying to find an Beginning thats actually also keeps me motivated. I had many Tries and always failed after some time to just keep going. i tried websites like W3Schools but i have a hard time keeping it going. My main Focus i want to do with C# is building Programs in Visual Studio and later on games in Unity or UE...

Help with Rage Plugin Hook V API

Hey I'm developing a AI dispatcher mod for LSPDFR and it's my first time working with C# I mean, working with the Rage API more than anything, is there someone who can explain me why the game keeps freezing as soon as it connects to my Python named pipe server?

HELP | Windows Context Menu Manager

Can someone help me with a windows context menu manager software? I started to create my own software, its almost done but need one more thing to let users to change the subkeys orders, i dont know how to change the keys placements ex: there is 3 subkey test1, test2, test3 i want to change the test1 with the test3... But without delete older keys and recreate new...
No description

Beginner question: classes and constructor code?

So I've read this section a few times and it is not going in. I understand declaring regular variables, but this page in my book is talking about "public class MyNumber" then later goes on to say MyNumber numb = new MyNumber, what is the purpose of this and what is going on? Why can't they just stick to int a = 123, what is the point in all this new class and horrible syntax?

Grainy gif output when using `Graphics` on source Bitmap

I've cobbled together some horrible test code for taking an a gif, writing some text to each frame and saving again, however I'm encountering a rather annoying issue. Read here If all frames are left as they are then the output gif is comparable to the input gif, however once I start using Graphics on the frames then the quality drops noticeably and in a way that makes me think it's using indexed colour however I can't find any explanation as to why this is or how I could go about fixing this. Anyone worked with GDI+/Graphics know what the hecc is happening here?...
No description

Beginner questions. prevent unhalted exception

I am really in the most beginner stage you can imagine though I have been messing around with other languages before so I know some stuff. I want to effectively use a beginner friendly option to prevent any other input but "y" or "n" to be accepted, which works fine, however null **values, CTRL + Z will still cause error.** Any advice without introducing classes, preferable a control flow based solution to prevent this null; (CTRL + Z ABORT) from breaking it? Here is my code: https://on...
No description

Adding Identity Core to an existing project

I have a ASP.NET core for backend and Blazor for front-end.

Help in coding a Aircraft Database

Hello, since a long time im looking for a software to store all my pictures I made in planespotting. Unfortunately there is no software for my needs, so I tried myself on Windows Forms, I failed, simply cant find a good documentation. I got a bit of C# and Java experience. Now Im looking for a coding partner which can help me create the software of my needs, so I can learn Windows forms and get a cool software. Im thankful for every help...

Some Sources to learn C# and Unity from nothing

I wanna get into indie gamedev, hobby rn but hopefully career eventually so im trying to find some good sources to learn unity and c# (Have no experience with coding or unity) Reddit and other places just got tons of different opinions so trying to get a clearer view of the best tutorials to learn both from scratch (free)...

merge into pattern

So I've read about patterns a bit I have :...
No description

C# MAUI with Material Design

Hello, I've been trying to use Material Design UI style with C# MAUI for a while. I found a library named UraniumUI, which doesn't satisfy me (it doesn't have hints in text fields). ...

✅ Event-Driven-Architecture Cons Issue

i have a microservice project as a backend and spa as frontend. I have some question while designing my service. When a user on a checkout page after pass the payment process which is a microservice a command will be thrown in the service to the order service. Order service will consume the command and save the order information to the database. My question is after the payment is processed normally, order information id,name,date etc. will shown to the user. But in this scenario (Event-driven-architecture) my frontend does not wait the order API response where my order information will be fetched. So how am I going to show the user it's order information after checkout process ? technologies; - Angular - .Net - PostgreSQL...

I'm new to .net

Hello, I have just entered the .net world, I started learning .net 6.0, but .net 8.0 is coming out, would I be making a mistake by learning 6.0?

Individual accounts authentication

Hello everyone! I am coding an application that consists of a server and a client. The server is a console app which I turned into a sort of an ASP.NET Web API. It's an executable that just handles everything coming from the client/s. The client is a Blazor web app which communicates with the server via SignalR. I want to set up authentication for the client (on the server). For now my client has individual accounts configured so it can auth only locally, I want it to auth using the server. Is t...

✅ .NET Worker service doesn't load appsettings.json into a class

Hello, I am trying to load configuration values into a class or record, but it doesn't work. The properties remain null. I do the following: ```c#...
No description

Temporary Pause

I am using .NET 8 I've got an ASP.NET API that i would like to pause. The goal of this is to prevent any endpoints from being called for a short amount of time. I could do this procedurally with a constant variable that's checked, but I would rather not send nothing. Is there some kind of HTML code i could return that would indicate that the API is offline but like on purpose? Instead of just returning nothing. ...

Storing types as strings

I need to store a Type as a string, then convert it back to a type. How do i do this? I've tried Type.Name then doing Type.GetType(typeName) but this returns null