C#

C

C#

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

Join

Groups & Clients in SignalR not taking requests.

I have 2 Hub tasks, 1. Connect 2. Send I save all connections that are being sent to connect with a game code, and store them in a group.....

Build NET9 from source

How to fix this, does anyone know? I try build dotnet/dotnet repo following instructions in: https://github.com/dotnet/dotnet/blob/main/README.md#dev-instructions What i do:...
No description

NuGet Private Assets not allowing access as dependency

I have one application that depends on another project. That project uses a NuGet Package. I want that NuGet package to only be availble for that core library to actually use; however, I still need it to be available as a dependency for the application.
<PrivateAssets>all</PrivateAssets>
<PrivateAssets>all</PrivateAssets>
seems to actually not even allow usage as a dependency... But in reality I just want the package to not be exposed directly to the programmer when working on the actual application. Any ideas?...

✅ Help with running github program (for dark souls)

Hey guys im playing Darksouls remastered and I'm trying to set up a dark souls death counter that I've foudn on github but I've actually got no clue on how to run it or how to actually start the file so that it does what its supposed to do. I will attach the github link to this post and hope somebody will respond soon. Thanks a lot in advance! https://github.com/quidrex/DSDeaths/tree/master...

Manually Showing MainWindow.xaml In App.xaml.cs (Dependency Injection)

Hey! My code is supposed to manually show MainWindow.xaml, but it doesn't if I remove StartupUri="MainWindow.xaml" and I get the error that is listed with details below with it. Without it, I get no error, so it must be my logic. The way I wrote it is because of dependency injection for AppLanguageServices. App.xaml ```xml <Application x:Class="computerComponentsTracker.App"...

extending noughts and crosses into N dimensions

im making N dimensional noughts and crosses (i was incredibly bored in class). for the sake of simplicity I've got it running with 4 dimensions for now. how would i extend it into N dimensions? obviously there'll be a finite amount of dimensions during builds. im just wondering how you'd do it for future use-cases too PS: this is probably way simpler than im describing it to be. im not very good at C# lol...
No description

NullPointException in the Update/Post method, but not in the Get Method

I started feeling puzzled at this NullPointException in this code ```[HttpGet]
public IActionResult EditListingJ(int? Id)
{ ...

How do i restyle the scrollbar, avalonia ui

I tried so many things. But i just cant seem to change 1 little thing of the style. For example i just tried to edit the thum to be rounded. And it just does nothing. I even tried putting a lot of parents below like so ```xml <Style Selector="ListBox /template/ ScrollViewer /template/ ScrollBar#PART_VerticalScrollBar /template/ Track Thumb Border">...
No description

fail to achieve bounce using return, update not running function

fail to achieve bounce using return, update not running function
No description

✅ Could someone draw a big red circle around Build Dependencies or send a link to a video on it?

Having a picture or video to look back at when I eventually forget again would be really helpful
No description

Separate local function with explicit 'return' statement

```C# string[] words = {"racecar" ,"talented", "deified", "tent", "tenet"}; Console.WriteLine("Is it a palindrome?");...
No description

✅ Can someone explain how this ternary expression works

c#
total -= TotalMeetsMinimum() ? 5.00 : 0.00;
c#
total -= TotalMeetsMinimum() ? 5.00 : 0.00;
Given that TotalMeetsMinimum returns a boolean....

Roslyn String Allocation

I'm interested in seeing exactly how Roslyn allocates strings. I looked through the GitHub a bit, but I couldn't find anything related to my question (Don't know where to look). First, please help me clear any misconceptions that I may have. For the following lines of code ```c#...

Optimistic concurrency failure, object has been modified

```public async Task<IActionResult> UpdateInfo(UpdateInfoDTO dto) { if (!ModelState.IsValid) { ViewBag.Errors = ModelState.Values.SelectMany(e => e.Errors).Select(e => e.ErrorMessage).ToList();...

✅ Public class in C#

Hello guys, sorry to disturb you all; can someone explain when do we use a "public class" and non-public class in C# pls. For example, consider the following code: ```C# using System;...

CRUD webapp Form is accepting empty responses after applying validations

I am stuck in making CRUD app first i Downloaded packages of EF then i create model class and db context and create migrations then i start creating my first view for creating/inserting data but the problem is when i run the program and try to insert nothing happens it only redirects me to index and when I open database to check wheather it is enter or not nothing was shown and also validations are not working #web...

this is a script i copied from a tutorial, for some reason it doesnt work the way in the tutorial.

This script is supposed to move a 2 object to the left, which it does but it does it too quick in the tutorial the guy said that * Time.deltaTime would fix it which it didn't for me please help im confused? ``` using System.Collections; using System.Collections.Generic; using UnityEngine;...

✅ Method declaration, outside Main Vs inside main

Hello guys, consider the following code: ```C# using System; ...
Next