Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Posts tagged c#
I'm writing a library "MyLibrary". In there, I group code into sections that make sense. Let's say I have a folder "Reports" and a folder "Helpers". I would like to have my code separated while ...
We have a console application using the Azure WebJob SDK. The WebJob relies on a WCF service using SOAP, which it accesses through a DLL we wrote that wraps the auto-generated WCF types in somethin...
Consider the following method as an example: List<int> Foo() { // ... } Are there any disadvantages of returning an interface instead of a concrete implementation in C#? IList<i...
The proposed library would sit alongside cross-platform libraries in Xamarin apps for iOS and Android. However, it would include files with names like MyLibraryFile.android.cs MyLibraryFile.ios...
The Code using Microsoft.EntityFrameworkCore; public class BloggingContext : DbContext { public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; } ...
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...
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...
I have two classes, Contestant and Picture, with the following setup: public class Contestant { ... public int AvatarID { get; set; } [ForeignKey(nameof(AvatarID))] public ...
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...
I have followed Nick Chapsas' tutorial to avoid throwing a ValidationException to treat validation errors and instead rely on LanguageExt.Common.Result<> from LanguageExt library. I have ma...
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...
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...
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...
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...
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...
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...
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 ...
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...
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...
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[...
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...
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...
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...
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;...
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...
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...
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 { ...
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...
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 <Window x:Class="Login_App.MainWindow" ...
Which concept is best for managed background services? 1. RunAsync(CancellationToken): interface IWorker { Task RunAsync(CancellationToken cancellationToken = default); } ... IWorker worker =...
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...
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....
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...
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...