C#

C

C#

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

Join

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

Unit test help

I want some to teach me why me xunit test programme did not stop. So I have to mannaully stop it in task manager

Clean Architecture

Good morning, everyone. As I posted on the code review channel, i made my POC project using CA. But it is handful to make several projects. So I only implemented the layers as folder. Do you think it is no problem. Please help me....

Design Patterns / Factory Method

I'm having some serious issues understanding what the Factory method does. We were given an exercise to learn it but i'm completely lost on how / what it is that i have to do.
No description

✅ enumeration help

can you call on the “index” of an entry in an enumeration? like say theres 3 options, red, blue, green, and i have an array with 1, 2, 3. if a random int is used to select between the array, can i also use that same random int to call upon the corresponding enumeration? i.e. red being called at the same time/in a similar way as 1, blue and 2, etc sorry if the question doesnt make sense, i can rephrase...

Data structure options for UI virtualization

I'm trying to find a good data structure for UI virtualization of collection controls to keep track of each control's estimated dimensions. Virtualization is (eg.) when you have a million data rows and only 10 can fit on screen, so you only create 10 controls. As the user scrolls, controls that move offscreen are recycled (returned to pool) and rows that now appear onscreen are materialized as controls. Because only on-screen controls exist, I cannot store row-specific metadata on them to later retrieve because they get wiped during recycling. The main problem I'm trying to solve is obtaining the total height of all rows when row heights can vary: combining actual measurements from rows that have been previously materialized and estimated heights for ones that haven't. While I could store row height information in a standard array, typical insert and delete operations will result in large move operations....

it doesnt let me insert a code into my sprite :c

So i tried to inster a script into my sprite but it doesnt work and it shows a error
No description