C#

C

C#

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

Join

ObeservableProperty onChange is called twice?

I am using the avalonia mvvm project. in my ViewModel I have this part of code: ```c# public ObservableCollection<MarkdownBlock> MarkdownBlocks { get; } = new ObservableCollection<MarkdownBlock>();...
No description

How to formate code in Visual Studio?

I press the button or shortcut to format Document and says it's ready, for me it's a big mess. I would like a linter for everyone who's working in the project.
No description

✅ Is it possible to Parse a string and identify it's type?

I want to scan an index of an array and identify if it's an operator such as (+,-,*) or if it's an operand (doubles). Is this possible?

Directory.Build.props

Hi, I want to use the Directory.Build.props file to set the <OutDir> of all projects in the solution. I want to set the path relative to the Directory.Build.props file itself, is this possible?...

.NET MVC Project Help!

I'm unable to Create records using MVC it just blinks and nothing happen when I fill the form and click CREATE!

✅ how do i update my nuget package?

google thinks i want to update it in my project, which i do also want to do on the command line, but how do i publish a new version of my nuget package?

Powershell script to automate run exe file

I have this script that is designed to automatically run an exe file in administrator mode everytime the user turn on the computer and login. ```powershell Get the directory of the script $scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition ...
No description

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)...