C#

C

C#

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

Join

Guessing game

Have several build errors for a guessing game i made in a form app using Guessing_Game; using System; using System.Windows.Forms; ...

OOP guidance (for myself)

I'm having a real tough time grasping OOP for a project in school using Monogame, like I can't quite figure out how to reference variables / sprites and such from other classes, maybe i'm just being silly but I was looking for any in depth OOP guides, tips or even talks from people

Call method with updated data

Hello, im currently trying to make an update function. I got 2 lists: ```cs public class AircraftData //stores the data for the startup...

navbar

i want to create a navbar with an expandable thingy kind of like a treeview i have this html ```html <div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">...

learning C#

having trouble with a simple code asking for name and age and the app should output it but doesnt seem to be working any help is greatly appreciated namespace collectNameAgeApp { public partial class Form1 : Form {...

✅ What's new in .NET 8 regarding making a WASM project?

Hello guys, I am looking into learning Blazor WASM. I was viewing some tutorials online on how to setup the project but everything seems to have changed since .NET 8. ...

Partial classes and platform specific code

Hello. Trying to create platform specific code and only use/compile the code for correct platform upon release. My current issue is that regardless of platform my linux specific code is trying to run on windows. I seen examples of it using MAUI, however i'm just trying to make a simple console app. In my csproj: ``` <PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))"> <DefineConstants>WINDOWS</DefineConstants>...

A problem with blazor while verifying cookies

I created a login system with JWT refresh token. The code works well when logging in and so on, but the problem occurs when the JWT expires. I need to send a refresh token request to get a new JWT. The process succeeds, but the issue is that during the first page refresh, the user is not activated. On the second refresh, they become activated. I don't know the reason, even though I ensured that the operations are not synchronized, so the request must complete before displaying the page after updating the cookies. However, what happens is the opposite, I think. What is the solution?...

Migrating to EF Core migrations

Hello I'm rewriting a whole backend from TS into C# and I'm struggling at the migrations part after I scaffolded the db context. How would I start using the migrations system EF Core has without just nuking all the data?...

✅ Z position controlling of my WPF window

Hello, guys, i'm developing a WPF application for a game, which source code I don't have. I want to make a window, that always will be on top of the game window, but if there is a some other window, for example browser, it can be on top of my application. I have one idea to use C++ functions for windows from user32.dll, but it looks complicated and I think there is a simpler solution. Is it?

SQL code invalid object name

i have written an SQL code and i get the expected result but it says invalid object name when i hover over the procedure name, it this a problem or can i just leave it alone?
No description

Developing a program

Hey everyone, I need help on developing a program. If you could help me, it would be greatful. Also, note that I'm not that good on C#.

Code formatter

Is there a plugin similar to Prettier in vs 22 IDE ? or is there prettier itself...

Integration Test issue on ubuntu-latest (.NET 8)

Hi, While running the basic example for integration tests with WebApplicationFactory in a .net8 (8.0.303) web api on ubuntu pipeline (https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-8.0 I'm getting this exception :...

✅ How do I disable copilot? I dont have it installed and yet it's there

As you can see in the screenshot, these extended suggestions are extremely annoying and pop up nonstop. This is in vscode insiders. I do NOT have any copilot extension installed.
No description

✅ hey I need some help!

Hey I was wondering if I could look to learn C# I need an C# teacher and if you could teach me then dm me!

the namespace is not recognised

hey so I am making a wpf app that will be a flight booking app but I will be storing user data on an azure sql database I am trying to create a REST API and so far I have made a ASP.NetService named FakeFlightBookingAPI I made this class named ApplicationDbContext to interact with my database here and I am trying ref my Admin and Customer classes that are part of my WPF project not my ASP project and my code is below ```cpp using Microsoft.EntityFrameworkCore; using FakeFlightBookingApp.Model;...
No description