Skip to main content

All Questions

0 votes
4 answers
224 views

Use-cases for Expression<TDelegate> except translating to another language?

So I just learned about Expression<TDelegate>. As a library author this really intrigued me; my libraries make extensive use of source generators to generate both high-performance code and code ...
Charanor's user avatar
  • 117
-2 votes
1 answer
163 views

Best Practices for Managing Multiple Entity Types in ASP.NET Core

I'm working on an ASP.NET Core application that requires handling multiple types of a single entity. Each type has its own properties and validation rules, which has led to confusion and complexity in ...
Marko Sami's user avatar
0 votes
3 answers
232 views

Use of environment variable or appsettings as a counter, good or bad practice [closed]

I'm wondering if it's bad practice to have a variable in a webserver which counts the amount of incoming requests and put it in an environment variable. In C# for example you have System.Configuration....
Vincent's user avatar
  • 383
0 votes
1 answer
370 views

How best to share common steps between services while allowing them to provide their own behaviour

I've started working on a C# codebase. There are three services which run the same set of steps of three kinds of objects, each returning IResult: public IResult FooService(Foo foo) { ... } public ...
hyperfiction's user avatar
2 votes
3 answers
470 views

C# Duplicated usage of an if/else condition and a ternary operator. A good practice?

I had a debate with a work mate regarding the following code as to which one of it would be the better practice: My code (in pseudo): var A = <precondition either TRUE or FALSE>; var B; if(A) { ...
Chams's user avatar
  • 29
-1 votes
3 answers
873 views

Would Injecting dependencies in C# as default parameters be a bad practice?

Given the (old) debate over whether Singletons are overused/abused/are worth it - would it be a bad idea to inject the dependencies as default parameters? In this way, we could get rid of defining ...
Veverke's user avatar
  • 491
-2 votes
2 answers
3k views

Best practices around writing testable extension methods

I’m currently working in C# and I’d like to write and extension method against a type. There is a small amount of repeated logic between classes surrounding JSON deserialization, using the ...
RTT's user avatar
  • 1
1 vote
2 answers
3k views

One API or Two APIs one for internal use and the other for external use

I follow the Layered architecture Like this: But with two differences: I use Blazor Assembly for UI Layer. I have API layer(REST) In between the presentation layer and the service layer. My ...
Anyname Donotcare's user avatar
1 vote
2 answers
113 views

Using public nested types to self contain complex POCOs for serialization

So a lot of the web says not to use public nested types unless you need the member visibility semantics (including this msdn article, even though that article hasn't been touched since 2008). For the ...
KallDrexx's user avatar
  • 331
1 vote
0 answers
60 views

How to implement timing-mechanism for fantasy draft process utilizing ASP.NET Core 3.1 SignalR

I have developed a Fantasy Draft system utilizing ASP.NET Core SignalR, along with Azure's SignalR service (for backplane/scaling stuff). Last year I utilized a poor-mans' javascript version that just ...
ganders's user avatar
  • 411
-1 votes
1 answer
8k views

What is meant by service? [closed]

We know there are services in windows but I am reading a book by Ed Snider and he uses the term “service” whenever his program requires a certain feature/functionality. Like he creates a navigation ...
zadane's user avatar
  • 397
10 votes
2 answers
2k views

What is the name for the integer part of a enum?

I've been writing some code comments, and I've been trying to refer to the index integer of a enum type, but I'm not sure what it's called. I'm tempted to call it the identifier, however there is ...
DubDub's user avatar
  • 645
8 votes
3 answers
7k views

Is it good practice to make everything internal in C#?

In our solution we have a couple of projects, a project for data layer, service layer, business layer. etc. Inside the business layer, we use models to transfer data from classes to classes. Is it ...
Tvde1's user avatar
  • 342
0 votes
1 answer
583 views

Methods linking bad/good practices

I have multiple methods calling each other to simplify changing anything in the code and to avoid fixing errors and copy pasting. It looks like this: Is this a bad practice? Does it cause too much ...
Candid Moon _Max_'s user avatar
1 vote
1 answer
277 views

NUnit specify TestCaseAttribute on implementation or create a test method

Based on this question about the correct usage of nUnit's TestCaseAttribute, I was wondering whether to specify the test case directly on the implementation or create test methods (as when using ...
user avatar

15 30 50 per page
1
2 3 4 5 6