As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [.net]

.NET is a software framework supporting a multi-language paradigm and supporting language interoperability. .NET applications are executed in a virtual machine (CLR) which provides a few important services: security, memory management and exception handling.

Filter by
Sorted by
Tagged with
0 votes
0 answers
1k views

Unit testing / TDD MediatR Queries and Validators

I would like to get a code review for the following code. It's meant to filter mocked products. I used to not like writing tests, but some time ago I realized how great TDD is. Not only it makes the ...
nop's user avatar
  • 709
0 votes
0 answers
120 views

BaseController with Generic Entity and Model

I created a controller with generic TEntity and TModel so that i will not have to repeat common actions like save/delete for each entity. I just want to ask if this is a good or a bad practice? ...
John Louie Dela Cruz's user avatar
0 votes
0 answers
398 views

Filter duplicate events raised by FileSystemWatcher

As you know about FileSystemWatcher Events, which may fired twice or more according to OS handling, For example creating a .txt file may fires two events (1)For ...
msh's user avatar
  • 1
0 votes
0 answers
199 views

ASP.NET Core 6 background DB logger

In an application, many actions need to be logged in the database. but this logging process should not slow down the request. So they should be done in an asynchronous queue or something. This is my ...
Parsa99's user avatar
0 votes
0 answers
126 views

Subscription manager - use cases with same parameters

The idea behind the SubscriptionManager class was not just to keep the subscriptions and resubscribe on reconnect, but also to support multiple callbacks in case of ...
nop's user avatar
  • 709
0 votes
0 answers
192 views

Is this valid MVVM when clicking an item to open a new window?

So I'm currently playing around with WPF and MVVM and I've been trying to find a way to select an item in a list and display it in a new window. And I came up with a solution that I personally like ...
RileyDan's user avatar
  • 131
0 votes
0 answers
753 views

Is there a faster way to read bytes with a FileStream?

So I'm trying to read data and store it in an array as fast as possible and the fastest method I found of doing so was this. ...
RileyDan's user avatar
  • 131
0 votes
0 answers
256 views

Wrapper around SignalR's implementation

I made a web socket client wrapper using SignalR's implementation, but there are some downsides that I want to improve. CancellationToken's implementation is wrong/incomplete ...
nop's user avatar
  • 709
0 votes
1 answer
101 views

Entity Framework - component shop using polymorphism and generic repository

I am creating a .NET Framework MVC EF application for PC components. I wanted to make full use of inheritance, polymorphism and generic repository pattern - but was wondering if my initial design ...
Shaun Falconer's user avatar
0 votes
0 answers
216 views

ThrottledStream

Need a ThrottledStream for a project, created the following class (still not tested), wouldn't mind some opinions on the code and suggestions on how it can be ...
cogumel0's user avatar
  • 171
-1 votes
3 answers
775 views

Distance too close

Are two points too close? Trying to do the math as efficiently as possible. deltaX + deltaY is going to be > than the actual distance You might use this in game play - are players in range? ...
paparazzo's user avatar
  • 5,946
-1 votes
1 answer
3k views

If and else without curly brackets [closed]

Is it possible to have an if condition with curly brackets and else conditions without brackets? Also what is the good practice to format it , should there be a new line after else keyword? ...
SmartestVEGA's user avatar
-1 votes
1 answer
33k views

Proper way to compare two Dictionaries [closed]

I am implementing an IEqualityComparer for Dictionary objects and am looking for input on a couple of different approaches. I define equality in this case to be that both dictionaries contain the same ...
dkackman's user avatar
  • 141
-1 votes
2 answers
25k views

Insert to datagridview when SELECT query has WHERE condition [closed]

I use this code to Load and Insert data to a table using a DataGridView in a C# windows application. ...
Ehsan's user avatar
  • 99
-1 votes
1 answer
117 views

Handling Entity Framework in connected mode within Windows Forms [closed]

I know the difference between the Entity Framework connected mode vs disconnected mode. In connected mode we do all the stuff inside one single DbContext instance. ...
Ahmed Suror's user avatar
-1 votes
1 answer
62 views

Measuring class load times with utility method [closed]

When ever I load a new class I measure the time it takes to setup, initializing and load that class, it helps me debug the time it takes to complete actions within my application. Here I have a ...
ropuxil's user avatar
  • 69
-1 votes
1 answer
70 views

Creating points in specific size [closed]

The method is in a new class and i use it from form1: In the top of the new class: public int numberOfPoints = 100; The class Init method: ...
Ronen Benzur's user avatar
-1 votes
1 answer
23k views

Calculate the area of different shapes using polymorphism (virtual and override methods)

I have written code to calculate the area of different shapes using polymorphism (virtual and override methods) and it is working as expected. Can anyone please review this and let me know how I can ...
Shan's user avatar
  • 29
-1 votes
1 answer
4k views

How to optimize response.redirect in ASP.net [closed]

We know when we call HttpContext.Current.Response.Redirect("http://tvrowdy.in"); It throw an exception. Can we do it this way(working fine). Need suggestions and ...
user25918's user avatar
-1 votes
1 answer
403 views

ASP.Net Core API JsonPatchDocument

Hi I am creating a website for my chiropractor and I am creating the API for data access. I am creating a HttpPatch Method and want to know if this is the right approach so would be grateful if you ...
Simon Price's user avatar
-1 votes
1 answer
137 views

Reduce CPU utilization in constant pinging to API and saving data in to database service [closed]

I have this hosted service which grabs the data from API every second and process the data and save it into the database. I have similar 3 more hosted services which run at the same time. Because of ...
Sam's user avatar
  • 127
-1 votes
2 answers
91 views

Improving predominance for updating 40000 records using entity framework [closed]

I have Two tables Circuit and Tag, Circuit ------------------ Id Name Path Tag ----------- Id Name Circuit_Id Now I have to loop through all the tags and ...
Simsons's user avatar
  • 723
-1 votes
2 answers
135 views

C# .NET 6, implementation of concurrent throttling tool

I'd like to seek advice on my implementation of rate controlling or throtting tool which implemented by C#.NET 6. correctness of implementation performance issue or any improvement can be done. <...
Timeless's user avatar
-1 votes
1 answer
143 views

Whats the best way to refactor a POCO class

In work I was asked to fix a bug which involved me making changes in a class. To fix the bug I needed to add a collection of a class that looks like this. ...
user16405900's user avatar
-1 votes
1 answer
57 views

Better way to keep a list of items from a Http Request?

I have a simple web api where each request "item" is stored in a list and thus a list is built without creating a new list per request. I have achieved this via dependency injection , but I ...
BigAl1992's user avatar
-1 votes
2 answers
79 views

How can I refactor a function to be inline? [closed]

I'm refactoring functions trying to do more of a in-line aproach. ...
Victor Gazzinelli's user avatar
-2 votes
2 answers
261 views

Euclidean distance between documents

For each function, I am manually adding another case. Can this be somehow shortened? Case and function names are the same. For example, the Euclidean_Distance case ...
Furkan Gözükara's user avatar
-2 votes
3 answers
178 views

Find target sum of 3 from and array

Input is a sorted array and a target sum. Find all sets of 3 unique elements that sum to a target. Looking for lowest order (big O). A, B, C are the indexes on the sorted array. A < B < C ...
paparazzo's user avatar
  • 5,946
-2 votes
1 answer
170 views

Document Management Properties and Searching

This is the 'middle-ware' for a document management application. A document has properties which describe it, and allow users to search for it. The server will interact with the database, and the User-...
paparazzo's user avatar
  • 5,946
-2 votes
2 answers
183 views

Project Euler #1: Multiples of 3 and 5 any solutions in c# with better runtime?

...
swapnil kumar's user avatar
-2 votes
1 answer
324 views

Improvements for this Rounding Method [closed]

This is used to round to any desired quarter, half etc. Is there any improvements that can be made for performance, unforeseen roundoff issues etc...? ...
code4Me's user avatar
  • 99
-2 votes
1 answer
55 views

Add new TabItem to a TabControl using Click Event [closed]

I'm trying to add a new TabItem to a TabControl. The TabItem's content will be set to a new Frame, and the frame holds the actual Page. A new Tabitem is added each time the button is clicked, this is ...
Raheem's user avatar
  • 1
-3 votes
1 answer
71 views

Generating property for a class instance [closed]

Hope, it's my last question about current project. Yeah, it's still about respecting SOLID-principles. And it's still about calculator, so i've got realization of ITerm interface: ...
Occam's chainsaw's user avatar
-3 votes
1 answer
223 views

Best Practice .Contains C# [closed]

I don't quite know where to post this but C# is not my first language and I am hoping to get someone to nod their head or correct me :) This works but seems counter intuitive - mostly because I ...
Missy's user avatar
  • 157
-4 votes
1 answer
2k views

DLL for basic math operations

I've written a simple C# class to use as a dll for simple math calculations: addition, subtraction, division, and multiplication. How can I improve this code, specifically for addition and ...
Kaviranga's user avatar
  • 117
-4 votes
1 answer
78 views

Generic Custom STACK Class for Hanoi Problem in C# [closed]

I have created a custom class (Generic) in C# for the Hanoi problem. and I am not sure I did the correct thing. ...
Navin Kumar K Subramanian's user avatar
-4 votes
1 answer
402 views

Would you consider this little project to be worth showing to potential employers? [closed]

I am self thought c# kiddy and wonder if little projects like one here, are worth showing to potential employers when looking for junior developer position. This code has some issues that i do not ...
Djdndb Rjrjjr's user avatar
-5 votes
3 answers
447 views

Application search form

I have a search form in my application. When I search, it takes too much time to retrieve and display data, so I need to optimize this code. ...
IJAJ MULANI's user avatar

1
21 22 23 24
25