C#

C

C#

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

Join

✅wrong warning

I came across a case where the C# extension in visual studio code generated the warning: The result of the expression is always 'true' since a value of type 'decimal' is never equal to 'null' of type 'decimal?'CS0472 code below ``` var aux = query .GroupBy(x => x.Data)...

Dash Panel Mechanic not working

I'm trying to implement a dash panel mechanic into my 3D Sonic physics engine. They are panels that allow the player to reach top running speed, and are even used to change the player's direction immediately. The direction the player dashes in is the forward direction of the panel they hit. They also lock sonic's controls for a set amount of time that I am able to define per dash panel. I've got the panels in scene with mesh colliders and is trigger checked and code written, except nothing happens when sonic actually touches the dash panel. Here are the relevant scripts to make this work: DashPanel.cs: https://pastecode.io/s/kr7t0vfj...
No description

✅ Main program input arguments

When i start my program i want the string inside static void Main(string[] args) to contain the string input.txt output.txt. How do i configure this?

✅ Distributed transactions

I'm developing a server + clients suite of applications. What bothers me is the chance that the client's communication with the server will be interrupted during writes. Primarily during several interdependent writes, e.g.:...

Visual Studio button not appearing (Obv C#)

I am using Vis Studio for the first time and I am trying to add a button but of course the button doesnt appear in run, I have no errors and I have already tried removing and re-adding the button and moving it around.

✅ Sharing C# projects with Github/Fork

So I've downloaded the software 'Fork' and i'm able to stage and commit changes to the project. Does anyone know what others have to do in order to access them and also contribute with pull/push?

Question about SignalR

I am connecting to websocket server using url with query data of group name to which user want to connect to: https(:)//localhost:5001/hubs/groups?groupName=${groupName}. On connection I make sure that group exists in database and userhave access to this group. Is it save to assume valid data, so every time client invokes method, to skip the part of checking in database that group name is valid?

Multi Assembly wwwroot folder Loading

Hey Guys, I loaded couple assemblies with ´McMaster.NETCore.Plugins` from type Microsoft.NET.Sdk.Razor because the Plugins i loaded have Blazor components which are registered... into the Loading Application... Now my problem is that the css and js Isolation from BlazorComponents inside the Plugins, are in their own wwwroot and cant be loaded by the LoadingApplication. ...

Dynamic Culture WPF

Hi, I have a question about handling dynamic culture changes in my WPF app. I'd like to change the culture while the app is running, so I call this method each time I change the app's culture. However, I have a problem when converting back a double input, because some threads were already open and didn't consider the new culture change. How should I handle this ? Should i do this in order to make sure the culture is consider Result = Convert.ToDouble(value, MyCurrentCulture);...
No description

Help

just trying to create a programme that adds up an even and an odd together
No description

Where to go from Basic C#

I already know all the basic C# stuff, like variables, if statements, loops, etc. and even a bit about libraries. However I have no clue where to go from here. It seems there is a lot to learn about C#, and there doesn't seem to be any "intermediate" tutorials on youtube. Can anyone tell me where to go from here?

WPF ListBox w/ Header Button IsEnabled Question

I have a ListBox that displays items in need of approval, the ListBox.ItemTemplate is set to a viewmodel displaying the item's view in the list and each has an individual approve button. I also have set the GroupStyle.HeaderTemplate to include an 'approve all' button, which I have working by using a behavior that uses the datacontext of the button (CollectionViewGroup) to send an event indicating which of the items should be approved. My items require being updated from several databases before they are ready for approval, which happens asynchronously and their individual approve buttons enable once they are in a state where approval is valid....

✅ Access a runtime Dictionary easier

My company is switching from ConfigurationManager with transforms over to a 3rd party secrets manager. The secrets manager returns a Dictionary<string, object> on start up. I'm needing to go through and replace all ConfigurationManager calls throughout the project and I was wondering if there's an easier way to access these values rather than magic strings. My first thought is a static class where I define all the property shortcuts and keys. Then verify all keys are present on project loa...

✅ Rate limiting no worky

Got rate limiting all set up: ```cs public static class RateLimiting { public const string Rss = nameof(Rss);...

✅ first contribute in Microsoft docs

I try to contrubite in microsoft docs when create pull request it end with error "Please fix OPS build warnings before merging. To see the warnings, click 'Details' next to the OpenPublishing.build status check at the bottom of your pull request "?

How do I make a good DTO of lot's of classes.

yo, i have a question, so I have a C# class, which basically has a bunch of classes as it's fields. Class King { public A AClassObj; public B BClassObj }...

✅ Source2Roblox API CHANGE

I need some help regarding a program called Source2Roblox, Although it converts Source engine models/maps to Roblox. I need help from changing the api + the way it handles on uploading the mesh format because the current asset uploading API in Source2Roblox is outdated and old and only supports a certain file type. The new one supports Open Cloud + more information can be given if needed. Main repo: https://github.com/MaximumADHD/Source2Roblox (Codebase) Code needed to be changed: Util/AssetManager.cs Newest/updated repo: https://github.com/Simoxus/source2roblox (No codebase, requires downloading everything.) Link: https://github.com/Simoxus/source2roblox/releases/tag/Application...

artifacted playback using `NAudio` with multiple raw pcm streams

hello there! i'm trying to implement voice chat into a custom discord library i'm writing. everything works great but the sound quality dips heavily if 2 or more users are speaking at once. you can see my player class below: ```cs public class NAudioPlayer : IPlayer {...

✅ Assistance with CMD Commands (if not allowed, please delete)

I'm creating my own custom .bat file that I am going to be adding to my startup processes. I'm trying to find the absolute (or full) path's to programs that my computer has, and the only way I know how to do that is I think the linux way as I tried ```console PowerShell 7.4.5 PS C:]Users...>whereis code ...

code help

uhhh im trying to run a program that will count how many 1s are in a string of binary, and if its odd or even itll do something, but it just doesnt work?
No description