C#

C

C#

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

Join

✅ Svg to png conversion

Hey Guys, I made a code in windows forms (C#) where I looked for all the svgs and I wanted them all to be converted to .png in a folder and i found imageMagick.Net, but I can´t find a way to convert the pictures with the .net version.. how can I do that?

✅ Solution Explorer Organization

Can anyone help me with organizing my Solution Explorer , I want to move Homecontroller.css file to Controller folder , I also need to create modules such as Admin and Shared , I am in the VC Channel , if not there text me so I can come
No description

✅ Firebase and Blazor assistance

Good afternoon I am sorry to bother but at this point I feel that I have completely exhausted all of my recourses, I have been having issues with a project integrating firebase login and I have been stuck on this for the past 13 days and have gotten nowhere, I have used AI, youtube, fullstack, w3schools, and many other recorces including additional discord chanels much like this one. If anyone could assist me and walk me through what I may be doing wrong based on my code I would be extremely gra...

nswag (OpenApi) typescript get error type

Hey, I'm generating an api client using nswag, here is an example route: ```cs [HttpPost("BeginLogin")] [ProducesResponseType(typeof(AppError), 400)]...

ResX localisation issue (android, avalonia)

The ResX files on android don't seem to be loading on the android app, they work fine on linux and windows but android just only accepts the default culture and doesn't show anything else no matter what language I choose. What I tried (none of these worked). (Resources is the locale resource.)...
No description

Is it appropriate to compare programming languages while learning a new one?

Is it appropriate to compare a programming language to another programming language while learning one? Say for example, in my case, I'm learning C# but I know a bit of java. I noticed that the syntax is almost similar and so in my head, for every thing I try to compare C# with java, is that correct to do so?

Performance loss on using united id?

if some entity was using AspNet User (string Id's) what I did was instinctly doing ```cs public interface IEntity<T> { T Id { get; set; }...

Expression vs Statement vs Expression statement in programming

Hello guys, I know it's a silly question but what is the difference between a statement, an expression and an expression statement in programming? From what I understood (please confirm and add to it if required), an expression should always return a value, a statement may or may not return a value (what does this mean? can someone elaborate and give example pls). What about "expression statement"...

✅ trying to install a dependency but I can't get it too work(completed)

basing myself off this tutorial for the dependency https://www.youtube.com/watch?v=E1_6gMd7IHo attempting to install this dependency https://github.com/jjohnsnaill/SubworldLibrary/wiki this is for a terraria mod here are the github and docs for that https://docs.tmodloader.net/docs/stable/annotated.html https://github.com/tModLoader/tModLoader/ this is my first time posting here so I apologize if this is badly formatted I have both the .xml and the .dll...
No description

✅ Declaring and initializing multiple values in a single line in C#

Hello guys, consider the following statement: int monsterHealth, heroHealth = 0; If I write this code, heroHealth is assigned to 0, will this also assign monsterHealth to 0?...

✅ User SendMessage or PostMessage on a unitplayer dll exe game

Does someone know how to make user32 - SendMessage / PostMessage work in a unityplayer exe game? mouse_event works but i need send/post message because i have the window minimized to keep using my laptop. SendMessage and PostMessage are working, but not to the given coords. It will click on the current position of my cursor

How to change AccentColor in WPF .NET 9 with Fluent Theme

Hi, i have a .NET9 WPF app and i'm using the Fluent Theme (https://learn.microsoft.com/en-us/dotnet/desktop/wpf/whats-new/net90?view=netdesktop-9.0#apply-the-theme) Since you can alter the theme (dark/light) easily for the app, I was wondering if there is also an easy way to change the AccentColor for only this one app? Does anybody know?...

Small issue about Visual Studio graying out things

Hello, I have this code, since I updated visual studio it marks the methods which are not marked with a greish look? I don't like it, and those methods are actually used when events or commands are triggered, anyone knows how to fix?
No description

Restrict loaded assemblies:

I’m writing a console app with a plugin system, for security I want to try restrict it to assemblies that don’t use certain namespaces like system IO with the intention being they have to request stuff like input and config values through interfaces. Is this possible and how do I check what namespaces an assembly uses ?

Enabling debug/trace logging only for certain parts of code as needed?

Let's say I have services A, B, C, and D, each of which log at different levels (Error, Warn, Info, Debug). By default my logging is set up so that if DEBUG is set (Debugging in Rider/VS), the minimum logging level is set to Debug, and it's not if it's not. When published, services A, B, C, and D will never log their Debug level messages. Now let's say I determine that service D is producing issues in a way that I could only reasonably diagnose with debug logs. How do I go about enabling Debug-level logging for ONLY service D? I'd like to avoid having to re-compile. Ideally, maybe something I could include in a config file - I am already utilizing a config.json and AddConfiguration pattern for other services. Part of the reason I can only properly diagnose these issues is that some of these chance encounters with bugs only occur as infrequently as once every 21 days, so just running it in Debug mode on my PC for that long would be...very annoying. And if I simply have it logging even in production, I can search the generated logs for debug output and see if I can catch on to anything....

Entity Framework Tracking not making changes to db

hoping someone can explain what im doing wrong i have a method that fetches all entities that i need into a list<entity> this data is then returned to a variable in my business logic layer...

✅ Issues with wpf binding

Hey guys, i'm having some issues with bindining a number Score to a Label in wpf, here's my code: ```cs public partial class MainWindow : Window { public static int Score { get; set; } = 10;...

✅ How does server fetch information from the correct user?

Title says it all. i have a asp.net and have implemented all the api endpoints and all that. and up to this point i have just gave the users their ID in the DB and they required to give that ID back to get the information they want. but now im thinking this is not very secure way of doing it. i have set up authorization and whenever a user wants to fetch a user specific info then i check the given token to the token that is stored in the user info. if it matches then i'd return the requested stuff. ...