Creating .NET applications on Linux
I am planning to learn C# and .NET Core and the tutorials are all in visual studio which is not supported in Linux. It's alternative is visual studio code on linux but what are the limitations of visu...
Difference between Infrastructure and Persistance layer in Clean Artchitecture ?
I'm currently learning how to build an API with a clean architecture. After reading a few articles, I followed a tutorial, and looking at what the final project looked like, I saw that the “Infras...
- Modified
- 3 May at 17:40
IIS 401 when I transported a site .NET 4.8 to a different IIS host.
The site is .NET 4.8 with **OWin**. I copied it from 1 working 2008 R2 box to another. I'm now getting 401's on several pages. It feels like authentication but I've double/triple checked th...
- Modified
- 3 May at 17:38
Why choose minimal API over controller based API?
I'm currently a student learning about minimal APIs. I am a little confused about their importance. Are they genuinely useful, or are they just a nice-to-have with little practical use? I've read a nu...
- Modified
- 3 May at 17:36
Websocket in dotnet with API Gateway and Fargate?
I'm building an ASP.NET core project. The bulk of it is a REST API, which we have deployed in a Fargate Container behind API Gateway. Those are partly client requirements, not my decision. For part...
Is this a misuse of Dispose?
I'm reviewing a class that implements `IDispose` and therefore has a Dispose method. In the constructor of this class we open a DB transaction. In the dispose method we commit the transaction and exe...
- Modified
- 3 May at 17:30
How to open an Angular+.NET project in Visual Studio GUI after creating it in VSC?
I have a [Angular+.NET](https://Angular+.NET) project where the 'client' folder holds the Angular files and 'api' folder has the .NET project. I started working on it in Visual Studio Code and jus...
Settle an Argument (Logical/Physical Layers, Clean Architecture, etc).
A colleague and I are going through an exercise of developing guidance around practices and conventions for writing Clean Architecture projects in our organization. We have project structure as fol...
- Modified
- 3 May at 16:6
Piece of code that can kill computer performance
I'm searching for code in c# that can kill computer performance (CPU performance, maybe cpu - memory link performance too) as much as it is possible (it will run on 4 core box so I'm going to create 4...
- Modified
- 30 Apr at 13:37
Reformat SQLGeography polygons to JSON
I am building a web service that serves geographic boundary data in JSON format. The geographic data is stored in an SQL Server 2008 R2 database using the geography type in a table. I use `[ColumnN...
- Modified
- 30 Apr at 13:35
Add web service reference from behind a proxy server
I'm using vs2010. In a simple console app I try to add a service reference to `http://***/service1.asmx` , old asmx service. My computer is behind a proxy server, so i get an error : > "The remo...
- Modified
- 30 Apr at 13:34
No more post back after file download in sharepoint
I tried to download a file from sharepoint. But after I download this file, I can't click on other buttons. What is wrong with my coding? **This is my first way.** ```csharp Response.AppendHe...
- Modified
- 30 Apr at 13:34
Sleep task (System.Threading.Tasks)
I need to create thread which will replace photo in [Windows Forms][1] window, than waits for *~1second* and restore the previous photo. I thought that the following code: ```csharp TaskSchedul...
- Modified
- 30 Apr at 13:31
Graphic - DrawLine - draw line and move it
In my .net c# program i draw few lines using values from text boxes (i use DrawLine function). I want to be able to move one of this lines by clik on it and move this line with mouse - is it possible?...
Find node when traversing tree
I want to implement a method that will enable me to find a node in a tree. The way I do it is recursively using global variables to know when to stop. **I have the class:** ```csharp class Nod...
- Modified
- 30 Apr at 13:30
Why use events for what I can do with Delegates?
I know Events are always associated with Delegates. But, I am missing some core use of Events, and trying to understand that. I created a simple Event program, as below, and it works perfectly fine...
Sharing DTOs between my API, Blazor web app and WPF client
I have recently been revisiting a project from a year ago where I had an ASP.NET web API and a WPF client. The WPF client would call the API and each project had a separate models folder where I dupli...
How to handle no matches case in List.First in c#?
In [IEnumerable.First][1] function, how do I handle the case if there are no matches? Currently it just crashes... ```csharp MySPListItem firstItem = itemCollection.First(item => !item.isFolder); ...
GridView Command Arguments out of sync after dynamic row inserts
I have a gridview (for displaying data only) with multiple LinkButton objects in each row. In the gridview's DataBound function, I iterate through the rows of the gridview and dynamically to add new "...
- Modified
- 3 May at 14:34
Covariance in C# .NET 4 Framework
Is it possible to cast a `List` to `List` in C# 4.0? Something along these lines: ```csharp class joe : human {} List joes = GetJoes(); List humanJoes = joes; ``` Isn't this what co...
- Modified
- 30 Apr at 12:19
Elegant alternative to int.TryParse
I feel that every time I use `TryParse` that it results in somewhat ugly code. Mainly I am using it this way: ```csharp int value; if (!int.TryParse(someStringValue, out value)) { value = 0...
- Modified
- 30 Apr at 12:10
Blazor Server App checking checkbox on task list leaves next item checked
I have a task list that users can check off from the list, which disappears because Show Completed Tasks is not checked. However, when the task disappears, the next task item is checked, smh which is ...
- Modified
- 10 Mar at 04:4
Access Dns from ASP.NET Core 8 Web API in Docker container
I have built an ASP.NET Core 8.0 Web API that gets the hostname of the connected client with the following code: This code worked just fine as long as I ran it in Visual Studio. Now I want to deploy m...
- Modified
- 9 Mar at 14:24
Deserializing JSON text to an object in C#
I have the following class: On the other hand, I have this json string: When executing: I got this error: > Exception: System.Text.Json.JsonException: The JSON value could not > be converted to System...
- Modified
- 10 Mar at 04:15
Is there a way to store a template of interpolated string in C#?
I have this class called `BaseMessage` that contains string field `Message`: And I have another class `ProcessMessage` that derives from `BaseMessage`: Overall this class is created in 500 different p...
C# Getter non nullable but setter nullable?
Is it possible to use C# accessors such as the backing field is nullable but the getter is not ? I want the getter to promise to the rest of the code the value is not null Since get; set; share the sa...
- Modified
- 10 Mar at 04:30
How does the .net CosmosDb SDK handle tasks in bulk support?
In the [examples for using][1] the bulk support, the tasks created by the SDK are awaited as such: In a more real world scenario, there might be a lot more await/async going on. Developers often await...
- Modified
- 10 Mar at 04:32
Intercept a message rabbitMQClient C#
I am making an integration service for a third party application. This application uses rabbitMQ for its communication. The problem I am having is that whenever rabbit publishes a message, the first t...
- Modified
- 10 Jan at 09:20
I need help creating mouse-centered zooming
I've been trying to make a system in my 2D unity game where you can zoom in and out by scrolling, and it should center that zoom around the cursor, like zooming in on a web browser. With the way the g...
- Modified
- 10 Jan at 09:35
Removing Noise (Jumps and Drops) from Sensor Data for Fuel Consumption
I am working with fuel consumption data received from a sensor, but sometimes the data contains noise (sudden jumps or drops) that makes it inconsistent. My goal is to identify and remove these outlie...
- Modified
- 9 Jan at 08:35
C# WPF Binding issue
I got this CurrentPage property on my mainViewModel like: public int CurrentPage { get { return _currentPage; } set { if (_currentPage != value) { _currentPage = value; OnPropertyChanged(nam...
- Modified
- 9 Jan at 09:43
Why must an internal method of a public interface be implemented via a public method?
I have a public interface. One of its methods is marked internal. And it has to be - it takes an argument that is an internal type. I write a public class that implements this interface, I do so via a...
How can I pause a task in C#?
I am a beginner in the use of task in C#. I have implemented a file generation window in my application which generates 3 different files. I have implemented the file generation function on a single t...
- Modified
- 9 Jan at 09:44
Use reflection to invoke methods in an assembly that contains a derived-class from the base-class that lives in another assembly
I have two projects/assemblies in a .NET Core solution. 1. Project A contains a base-class called `FooBase` 2. Project B contains a derived-class called `FooDerived`, as well as a bunch of other class...
- Modified
- 1 Jan at 10:58
Why aren't the string formats for the float equivalent, and why does "N9" produce a value that is different?
I would like to understand what is going on with this code: where the value of `flt` in the debugger is `0.123`: [![enter image description here][1]][1] The documentation on [the "#" custom numeric fo...
- Modified
- 1 Jan at 11:3
How can I execute C# code using Roslyn from a string and use global variables from a Dictionary<string, object>?
I'm working on a C# application where I need to execute C# code provided as a string input using Roslyn. The challenge is to execute this code and access global variables stored in a `Dictionary`. The...
Entity Framework keeps throwing Duplicate Primary Key Error Despite Rollback
Running on .NET Framework 4.6.2, I have a method that uses Entity Framework to insert a row into a SQL Server database table. It uses a transaction that gets rolled back if an error is thrown: publi...
- Modified
- 1 Jan at 11:41