C#

C

C#

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

Join

How to learn MAUI ?

Hi everyone I have 2 years of experience in programming with C#, mainly focused on creating games in Unity. Now I want to expand my skills by developing applications on the .NET platform, particularly with .NET MAUI. Could you please advise me on the best way to get started with .NET MAUI? What should I pay special attention to as someone with a Unity background? Are there any essential materials, courses, best practices, or specific projects that would be good to work on initially?...

Run ASP.NET Core app in Test Container

I have an ASP.NET Core app that is a server for my WPF UI applications. The server depends on a SQL database and a NoSQL database. I wish to perform automated UI tests on my applications while ensuring that the server is clean for each test. I have discovered Test Containers and I understand that I can spin up containerized instances of the databases....

✅ Ajuda a um jogo de xadrez (Help with a game of chess) C# Windows Forms Visual studio

preciso de ajuda a finalizar esse jogo de xadrez (I need help to finish this chess game) #C#, #windowsforms, #gamechess #chessgame...
No description

DataTemplate tag in Xaml

Greetings, I don't know why this error keeps showing up The folder and .xaml files are all in the correct directory but the error said they don't exist in the namespace...
No description

How can I reference multiple generics in summary?

This does not work. Is there a way to do this? ```cs /// <summary> /// </summary>...

✅ LINQ help: IQueryable<Entity> -> Dictionary<string, Entity[]>

Hi, all: I'm looking for some help in writing a LINQ query. I'm interested in creating a dictionary where the keys are LogDatum.SerialNumber (nullable string), and the values are an array of the hourly maximum of LogDatum.Current (nullable double). This means I'm looking for an array whose elements are the maximum LogDatum of a certain hour. A sample of a dictionary I'm looking for: ```cs Dictionary<string, LogDatum[]> myDict = new() {...

Dynamic header in _Layout

Hi there, I'm trying to get my head around how to dynamically change my nav header in the _layout.cshtml file. I want to add a new section to it if a user is in a specific zone. Then this section will use some data I pass in to create itself in the header. Does this mean that I need to pass in a model with the zone and data into the layout? Given that the layout is used on all pages will this be an issue if I don't pass in this model? ...

Securing a plugin system:

Is there any alternatives to app domains in dotnet 9 for preventing access to the file system when implementing a plugin system using AssemblyLoadContext?

✅ 2 Databases Identity.ef + my CustomDb FK INSERT issue

So i have webapp with webapi, I've made Controllers, Services etc... all looks correct I've debugged it and the data passed to models look correct to what i have in SSMS, like the userId. but somehow when i try to create new TodoList it fails with error: ```...
No description

Parameterless constructor in struct

```public struct MyStruct { public int id; static int count = 0; ...

A connection was successfully established with the server, but then an error occurred during the log

what is the issue in my connection string
Scaffold-Dbcontext "Server=.;Database=authdb=User Id=sa;Password=aptech;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Scaffold-Dbcontext "Server=.;Database=authdb=User Id=sa;Password=aptech;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
...

BL Mapping help

I have finished my BL DTO's and want to map my DTO with the EF DAL How do I map it when inside the create DTO is a another CreateDTO? ```cs...

WPF Window Navigation

I'm currently learning about SQL and how to make it communicate with my IDE. For that I would like to further expand my skills in Navigation between Windows (MVVM style) because currently it irks me that 7 windows are open at a time when I test out my application

✅ CSS styles not loading on "Local" environment, only "Development"

I'm creating an application with razor pages. Everything went fine until I decided to switch from "Development" to "Local" for the environment in launchSettings.json. Now the website has no styles and my static files (css, js) are all empty when viewed in the browser. How do I fix this? Help really appreciated...

Can I initialize and instance of an object in an array with its index in the array?

Below is what I want to achieve. Thanks in advance for the help. I'm a beginner so sorry if this is a very missworded question ```public class MyClass { public MyStruct[] structArray = new MyStruct[10]; print(MyStruct[n].id);...

I don't understand this warning: BL Mapping (Mapperly)

The member User on the mapping target type RestauraceNET8.Data.EF.DAL.Entities.Restaurace.RestauraceAkceStolu was not found on the mapping source type RestauraceNET8.Data.EF.BL.DTO.RestauraceDTO.Akce.RestauraceAkceStoluCreateDto It's my first time trying out Mapperly I don't understand why it can't find the Id of the target...

✅ Non-nullable property netstandard2.0

Hello, In new .NET versions there's the required keyword for this warning, but what's the best way to solve this if not possible? Recently allowed a library to support older .NET versions, and I have no idea what's the preferred way to resolve this....
No description

Binding a class to a button

so I am trying to make it so when the user clicks the view details button a message box pop ups showing extra details but I am getting this error System.ArgumentException: 'Parameter "parameter" (object) cannot be of type MS.Internal.NamedObject, as the command type requires an argument of type SharedModels.BookedFlight. Arg_ParamName_Name...

✅ Input boxes not working

This is an assignment I am currently working on, everything runs without errors but I can't get the white boxes to work to input numbers. What am I missing? The goal is to put numbers in tickets sold and use calculations to see how much revenue is generated. I can't test my calculations since I can't input the numbers.
No description

✅ Help

I am trying to make an app where it blocks all apps from being used during a specific timer. It's to not open any other app while for example studying or something. So I made my Listbox, but there's no running apps showing that you should be able to block during this time. I did most of the coding but I can't seem to figure out how to fix this issue. Dm me if you can maybe help me fix this issue.