Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read
Q&A

Posts tagged c#

Use for questions dealing with C# ( a high level, statically typed, multi-paradigm programming language developed by Microsoft). C# code usually targets Microsoft's .NET family of tools and run-times, which include the .NET Framework, .NET Core and Xamarin among others.

This tag doesn't have a detailed wiki yet.

60%
+1 −0
Q&A Datagrid in MVVM saves edits but not inserts

I am writing a todolist application in WPF with MVVM. I display the goals in a datagrid and the editing works fine. Changes made in the grid are saved to the DB when I click save. However, adding a...

1 answer  ·  posted 1mo ago by FrankLuke‭  ·  last activity 1mo ago by Alexei‭

Question c# mvvm wpf
50%
+0 −0
Q&A How to define Polly policies when working with Refit library in ASP.NET Core?

Note: this is based on my question on SO and subsequent activity there I am trying to add resilience using Polly to HTTP calls that are performed using Refit library. I am using the Refit factory...

1 answer  ·  posted 1mo ago by Alexei‭  ·  last activity 1mo ago by Alexei‭

60%
+1 −0
Q&A How to refer to the same class twice from one Entity Framework entity?

I have two classes, Contestant and Picture, with the following setup: public class Contestant { ... public int AvatarID { get; set; } [ForeignKey(nameof(AvatarID))] public ...

1 answer  ·  posted 2mo ago by FrankLuke‭  ·  edited 2mo ago by Alexei‭

42%
+1 −2
Q&A How to generate random objects at different locations on x, y, z axis

I have been trying to generate a random object on all three axis in different locations. However, Vector3 doesn't accept that many overloads e.g: Vector3 spawnPos = new Vector3(Random.Range(spawnL...

1 answer  ·  posted 2mo ago by simonJN‭  ·  last activity 2mo ago by InfiniteDissent‭

Question c# unity3d
50%
+0 −0
Q&A Working with a generic class that uses a type that should be of generic type

I have followed Nick Chapsas' tutorial to avoid throwing a ValidationException to treat validation errors and instead rely on LanguageExt.Common.Result&lt;&gt; from LanguageExt library. I have ma...

0 answers  ·  posted 5mo ago by Alexei‭

Question c# generics .net .net-6
66%
+2 −0
Q&A C# WPF datagrid not persisting inserts

I am working with VS 2022 and trying to make a WPF MVVM application. The application updates the items displayed in the datagrid, persisting the changes to the database upon save. However, adding a...

0 answers  ·  posted 6mo ago by FrankLuke‭

75%
+4 −0
Q&A WPF MVVM ListBox not updating

I am trying to combine MVVM in WPF using Microsoft.Toolkit.MVVM. Somethings are working as expected. The text boxes bind to fields and update in both directions. The button command executes and cha...

2 answers  ·  posted 8mo ago by FrankLuke‭  ·  last activity 8mo ago by elgonzo‭

Question c# binding mvvm wpf
75%
+4 −0
Q&A Measuring arithmetic overflow checking overhead in C#

Overflow checking for integral-type arithmetic operations is disabled by default and it can be explicitly enabled by using using checked function or the -checked compiler switch. Since I mainly de...

2 answers  ·  posted 10mo ago by Alexei‭  ·  last activity 10mo ago by Derek Elkins‭

Question c# benchmarking
66%
+2 −0
Q&A What are the drawbacks of using data snapshot testing?

Our team is finally focusing on writing more automatic testing and one of my ex-colleagues recommended to try out the Verify library. The tool does the following: runs the test and compares the...

1 answer  ·  posted 10mo ago by Alexei‭  ·  last activity 10mo ago by Derek Elkins‭

71%
+3 −0
Q&A Why static code analyzers such as SonarQube indicate a high code complexity for switch statements?

During a presentation of a pipeline configuration, a colleague showed a SonarQube integration and one of its reports. A warning was caused by overrunning the max value for the code complexity thres...

2 answers  ·  posted 10mo ago by Alexei‭  ·  last activity 10mo ago by Derek Elkins‭

77%
+5 −0
Q&A How to dynamically change panel of ItemsControl?

Let's say I have some collection of data. My goal is to provide different kind of view of ItemsControl depending on user`s preference. For simplicity, we can assume that user can select only betwe...

1 answer  ·  posted 11mo ago by FoggyFinder‭  ·  edited 11mo ago by FoggyFinder‭

Question c# .net mvvm avalonia
75%
+4 −0
Q&A Get the length of a slice from a multi-dimensional array

If I have a one-dimensional array, I can get the length of it quite easily: var x = moves.Length(). However, if the array is multi-dimensional, .Length() returns the total number of elements. If ...

2 answers  ·  posted 1y ago by FrankLuke‭  ·  last activity 1y ago by FoggyFinder‭

71%
+3 −0
Q&A Credentials for multiple tenants with Azure.Identity

Situation: I have an Azure account which has management permissions for various subscriptions in various directories (tenants). I have a GUI tool to do various management tasks whose details are ir...

0 answers  ·  posted 1y ago by Peter Taylor‭

71%
+3 −0
Q&A How do I redact values when Save()ing a yaml structure with YamlDotNet?

I handle several projects that use yaml files for configuration, and load them with YamlDotNet. It is sometimes useful to log the effective configuration when the program starts, to aid future debu...

0 answers  ·  posted 1y ago by ajv‭  ·  edited 1y ago by Troy‭

Question c# .net yaml yamldotnet
31%
+3 −9
Q&A Find the name of the student with the top mark, display their name and mark

I have a CSV file like this: name,surname,score Moon,Walko,148 Jerald,Gryder,150 I need to find the highest score. My attempt: namespace test { class Program { string[...

1 answer  ·  posted 1y ago by InPut‭  ·  last activity 1y ago by FoggyFinder‭

Question c# csv
60%
+1 −0
Q&A Saving modified data in gridview on clicking SaveButton

I am struggling to do a save button in C# Windows Form Application where I have a GridView and I want to save all modifications I do in GridView Table(I connected it to SQL). This is the data sourc...

1 answer  ·  posted 1y ago by Cri‭  ·  edited 1y ago by Alexei‭

Question c# winforms gridview
75%
+4 −0
Q&A How to generate multi-line completions (code generation) with OpenAI?

I have finally received access to a trial account on OpenAI and I took it for a spin. My interest is with code generation, so first tried something simple using the playground: Q: generate a stand...

1 answer  ·  posted 1y ago by Alexei‭  ·  edited 1y ago by deleted user

50%
+1 −1
Q&A Why are my EMA values ​​different from the ones on the website? [closed]

I wrote a program for calculating EMA, but my values ​​differ from the values ​​calculated on this site. My program: double[] x = Numbers();//array numbers int N = 5; double k = 2.0 / (N + 1...

0 answers  ·  posted 1y ago by kolaa‭  ·  closed 1y ago by Alexei‭

Question c# .net-core
81%
+7 −0
Q&A Update list based on presence of identifier in a second list

In C#, I have two lists and need to mark records in the first based on the second. Here's a sample: public class Vehicle { public string Make { get; set; } public string VIN { get; set;...

3 answers  ·  posted 2y ago by FrankLuke‭  ·  last activity 1y ago by Andrew Shepherd‭

Question c# linq
75%
+4 −0
Q&A F-bounded polymorphism, interface operators, and type inference in C#

C# language version 8.0 introduces limited support for static methods, operators, etc. in interfaces. However, there are still limitations. I was hoping to use the new language features to try a ge...

0 answers  ·  posted 2y ago by Peter Taylor‭

75%
+4 −0
Q&A Declaring interface members with generic return types: "The type parameter [generic type] cannot be used with type arguments"

I'm trying to write an interface to define the set of operations I expect my repositories' Unit of Work implementations to have, and I want this interface to be fulfilled by EF Core's DbContext cla...

2 answers  ·  posted 2y ago by Marc.2377‭  ·  last activity 2y ago by Marc.2377‭

66%
+2 −0
Q&A C# WPF MVVM View & Get new record values

Just looking to hear some reviews on my current MVVM Implementation, If I am heading towards the right direction. :) Code BaseViewModel public class BaseViewModel : INotifyPropertyChanged { ...

1 answer  ·  posted 2y ago by gzi98‭  ·  last activity 2y ago by FoggyFinder‭

Question c# mvvm wpf
57%
+2 −1
Q&A How to filter data from the view using MVVM Pattern?

I am trying to filter data in the DataGrid using the texboxes using the MVVM pattern. Just not sure how to do it. Would appreciate any guidance. My current code: Model public class Technical_Bes...

1 answer  ·  posted 2y ago by gzi98‭  ·  last activity 2y ago by FoggyFinder‭

Question c# mvvm wpf
80%
+6 −0
Q&A C# MVVM Login Project

I was wondering if somebody can review my code? I am creating a simple login desktop application, just to get used to the MVVM pattern using WPF. View &lt;Window x:Class="Login_App.MainWindow" ...

2 answers  ·  posted 2y ago by gzi98‭  ·  last activity 2y ago by Peter Taylor‭

Question c# mvvm wpf
72%
+6 −1
Q&A Which abstraction should I choose for background services and why?

Which concept is best for managed background services? 1. RunAsync(CancellationToken): interface IWorker { Task RunAsync(CancellationToken cancellationToken = default); } ... IWorker worker =...

1 answer  ·  posted 2y ago by Kir_Antipov‭  ·  last activity 2y ago by Alexei‭

60%
+1 −0
Q&A Cache data using Redis Cache in an ASP.NET Core 3.1 project

This is an unanswered code review request of mine from Code Review Stack Exchange. Overview I have developed a small ASP.NET Core 3.1 Web API that provides information that is rarely changed (sever...

0 answers  ·  posted 2y ago by Alexei‭

66%
+2 −0
Q&A Measure ASP.NET Core 3.1 Web API action execution times

This is basically an unanswered code review request of mine from CodeReview Stack Exchange. I want to be able to log as accurately as possible, the time spent by a certain Web API action in an ASP....

0 answers  ·  posted 2y ago by Alexei‭

66%
+2 −0
Q&A How to perform LINQ joins with multiple fields in a single join?

Note: this is an aggregate of the answer provided for this question. I want to get the LINQ equivalent of the following from SQL: SELECT .. FROM entity1 e1 JOIN entity2 e2 ON e1.field1 = e2.fie...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Alexei‭

Question c# linq join
80%
+6 −0
Q&A Is it recommended for ASP.NET Web API actions to always include a CancellationToken?

Note: This is basically a question from Stack Overflow that was closed for a very long period of time and I fear it might get closed again as primarily opinion based. I am wondering if my ASP.NET C...

1 answer  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by Peter Taylor‭