C#

C

C#

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

Join

SQL code

"Add a Quality Label table with a foreign key from the Suppliers, with the default value corresponding to 'medium' quality. Don't forget to add a column to the Suppliers for the foreign key. Also add the following values to the table" we are using the northwind schema and i have tried to insert this but i keep getting invalid column name no matter what i change it to and i dont know why....
No description

Strange memory usage in C# OpenTK project

Hi! I'm developing a voxel engine using C# with the OpenTK Library, however my current bottleneck is memory usage. The visual studio 2019 memory snapshots show a total memory usage of only 250 mb, however, task manager reports a memory usage of a whopping 4 gigs. The memory graph in the performance profiler shows a massive 10 gigs of memory usage, which is far more than task manager reports. Where are these inconsistencies coming from? Aren't they supposed to report the same memory usage? The memory stays consistent when standing still ingame, like it's supposed to, so I think a memory leak is out of question. Where could this extra memory usage be coming from? Could it be some strange openTK implementation that allocates memory?...

Implementing a Service that caches requests and then executes on an interval.

Any examples I could look at for something like this? I have some objects that when they are created need to refresh some data from a service endpoint that has strict requests per minute. However I can batch a set of objects and request data for many of them only using one request. If I have a service ...

✅ Invoking an event on property changed (WPF)

Hey all, Just wondering if someone can help me wrap my head around how this works, I am not sure where I am getting caught up but I am sure I am not understanding something. Just started learning WPF and C#. Sorry for the data dump. I have a text box, a button and a textblock. I am just trying to make the text from the text box be set in the textblock. I have have my bindings working but I don't understand HOW they are working. ...

Is it Heap Corruption

A .NET framework 4.8 web app memory slowly spikes with GC2 never runs whenever I take PerfView trace but recently this is exception I took memory dump on because otherwise I was not able to take full memory dump because of invalid handle - can someone explain that is it heap corruption ?
No description

As a beginner,

Is there any website or application to practice and learn more of C#? Kind of like it teaches you what to do, then you put it to work and see the code do something cool. Also, are there any games that make you write in C# to do certain things, kind of "The farmer was replaced" on steam.

Newtonsoft.Json issue

i added the newtonsoft.json package and it's mentionned in the project configuration file but when i call it in the code it gives me this error
No description

✅ Senior .NET Developer Needed

I am looking for a qualified .NET developer with native English communication skill to conduct technical interviews for my team. If you are available and interested, please let me know your availability for a brief introductory call to discuss the role and requirements in more detail....

WPF CollectionView Filter on Property of Model?

in a MVVM WPF app, how would I go about filtering a ListBox that is bound to a property of a model? ```cs //Model class Y {...

✅ Weird .net error that comes out of nowhere when i start up my project

can anybody help me understand why all of a sudden whenever i open my project i get this error Note that Load\Riivolution\WheelWizard\riivolution\save is a path we use in our codebase and stuff. But its so really weird that it just pops up this error out of nowhere without having to run the code at all. Just opening the project is enough for this error to pop up...
No description

✅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