C#

C

C#

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

Join

Not writing, but not returning errors

```cs private void button1_Click(object sender, EventArgs e) { try {...

✅ Launch app at window startup

How can I make my app launch automatically at window startup ? Like windows defender for example

Getting Out of Memory Exception when loading in images

I get a system out of memory error after calling Image.FromFile in GetTarget(). How should I fix this? ```cs public ImageManager() {...

✅ Can help me with this error of uuid.lib

this is the error impossibile aprire il file 'uuid.lib'
No description

✅ Avalonia - Can't see anything even though control is styled

I am trying to follow along with this lovely example. https://github.com/AvaloniaUI/Avalonia.Samples/blob/main/src/Avalonia.Samples/CustomControls/RatingControlSample/README.adoc The problem I am having is that the example uses ReactiveUI and I am using the community toolkit, but really that shouldn't matter since there isn't any MVVM going on in my code. I just want to see some stars. For some reason I can see the stars in the resource file...
No description

How do I detect if the mouse position is outside a panel and its children in WinForm

The panel in this case is the blue box behind the per 100g and per item buttons. I was going to use a mouse.Leave event to trigger when to hide my drop down menu however if the mouse 'leaves' the panel and hovers over the per 100g button it would trigger the event and hide the menu. So instead I trying to check if the mouse is outside the panels boundaries before hiding however the mouse location is much greater than the panel position even though the mouse is inside the panel. Anyone know how to convert the 2 positions into the correct values for this case? Thanks ```C# Point MousePos = MousePosition;...
No description

Global key events listener (when app window is minimalised or out of focus)

Hi! I'm making an Avalonia UI app and I want to listen to keyboard events even when app window is minimalised or I'm doing smth else in other app. Do you know a "good" way to do that? As far as I know it's not possible to do it through Avalonia itself and additional library is needed. I looked on NuGet, but those I found were not really pupular.

Azurite to run in VS or Docker

As the title suggests I wonder if there are any tradeoffs whether I should use Azurite through the built-in Visual Studio method or to implement it through Docker? The project is already configured in Docker, so maybe that's a hint it should be used through Docker too?...

Kafka Flow (Producer Consumer arch.)

I'm having a lil issue with registering consumers on Kafka (using kafka flow).
No description

✅ CSS and JS Files Not Recognized in ASP.NET Core Project

Hi, I'm new to ASP.NET Core development. I'm trying to link my HTML layout to my ASP.NET project, but the CSS and js files don't seem to be recognized, even though I've placed them in global files. Does anyone have any advice on how to fix this?

Local user accounts with Entra External ID in Blazor WASM BFF application

Dear colleagues, I am currently researching our options to move away from local identity user accounts using Microsoft.Identity and EF Core. Currently, we have landed on Entra External ID as one of our options, but this question "shouldn't" really be vendor dependant. ...

✅ Guidance in software development

I have completed my graduation in electrical engineering. Now from over 1 year I am working in software company as web developer. Since it is major switch for me I can only do google search and references to stay and complete the work in company. I do not know how where to start so that I can compete with other developers.

✅ using

I keep seeing variables defined within a using, like
using(var connection = new SQLiteConnection()){
...
using(var connection = new SQLiteConnection()){
...
...

✅ How can I integrate PayPal donation with asp.net?

Hello, I'm going to integrate PayPal donation to my website. My website have several customers. So my donation page UI is like attached image....
No description

C help

can anyone help me with coding a shmup type game understanding screen position/firing projectiles

can someone review my comments?

```cs using System; namespace ExampleNamespace {...

✅ Minimal API IIS Deployment: 404 Error

I'm having difficulty deploying a minimal api project to IIS. As a test, I've created the basic API project base template with no changes. I'm able to start the API in command line without issues, but browser just fails and I cannot figure out why. The only thing I can find in Event View is a failure to redirect to https, but disabling the UseHttpsRedirection() option doesn't fix it. I've also ensured IIS_IUSRS has access to the website directory. Any help would be appreciated
No description

How to update UI easily on variable change in MAUI

I need to update a lot of text and it is desirable to link the update to a change in variables, I tried to use binding, but as I understood it, it does not suit me

Best way to search and replace substrings in large XML files

I have ~10 large XML files for my installer projects that I need to update programmatically. I'm working on my deploy app, and I need a way to automatically update the file paths listed in the XML file. Each file used by the installer projects has a build version as part of the file path, and I need to update that part of the string. This will be anywhere from ~20 replacements to 500 replacements, depending on the installer XML file. Looking around, it appears the main way people usually do this is to read the entire file into a String variable, then run a search and replace, then load the string back into the file. Some of these files are quite large, with about 40k lines and 900k characters.
Are there any methods that are more optimal than using something like the XDocument or File class and reading them into a String?...
No description