C#

C

C#

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

Join

VSCode being a bitch

I used dotnet new console -n Main to generate a new c# environment in vscode, but I can't run and when I try dotnet restore to fix whatever issue I likely have, I can't restore because:
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
Which is obviously not right because I do have a .csproj file.. and a .sln....
No description

How i can make title bar transparent and be inside of my form

Is it possible to change the title bar of a WinForm to be trsnparent and be inside of my form? ``` __ [Form1___-|[]|X] <- this thing over here...

Mapperly Help how to map child CreateDto's?

I have a problem that I cannot solve at the moment I still don't know how to map the properties of the child CreateDto's. Mapperly documentation I didn't find anything about it or just don't understand it. If someone can guide me or help me map this so I can do this to my other entities. MapperProfile:...

Game development help

Hey guys I'm developing a board game and I don't know how to read the numbers from the dice, the dice was made in blender and animated in UNITY

Data structure in C# - Dictionary<TKey, TValue>

Hello guys, I have a quick question... I have a miss-conception, when we say the term "dictionary" ; is it just another term for a hash map/hash table? Or it just uses the idea of hash table behind the scenes? Because if I remember correctly, we also have the concept of Hash set where there (I think), it takes only one generic parameter. How does these 2 differs in terms of one is key-value and the other is just the value please, I'm a bit confused.

Quiz outputting wrong code

My code asks the questions correctly and the ascii art like I want it to, but whenever it finishes asking the questions it starts printing out the answers to the questions at the top of the console. How do I prevent this?

✅ Enums as strings on AspNetCore controller .NET 9

I have added this enum ```csharp [JsonConverter(typeof(JsonStringEnumConverter))] public enum Locale {...
No description

is there anyone who can help me to setup prometheus inside the k8s cluster

I need a help with implementing prometheus/grafana inside the kubernetes cluster

Formatting .CSS files in a blazor project

Howdy, Sitting with a blazor project, .NET 8 wasm, it got some .CSS files, like the app.css and so one. I would like to just format these files in a sane way. I'm used to frontend in JS, and where I can just use prettier and save my files in vs code and it will format the file in a nice way. The document formatter in Visual Studio works but it's so opinionated, it does the basic things like adding whitespace if missing, fixing indentation etc. But it doesn't respect blank lines. Even when they're put there on purpose to create clear structure. The vs code solution I'm used to has no issues with this, but visual studio just rips the blank lines out. I can't find any setting for this either, any tips?...

Can I rearrange dll files?

I will translate GTA 5 plugins from English, is this possible?

XAML property issues

My markup apparently does nothing for Backgorund, but it does for Foreground. How does that make sense? I need help setting a selected background to the same as the non-selected ones as well as using the same hover color as my button, which apparently doesn't work for the ComboBox(Item), but it does for Button. XAML ```xml <UserControl.Resources>...
No description

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
Next