Use ThrowHelper instead of throw new Exception


When we want to raise an error in the program, we usually use throw new exception and put the appropriate text of the error in the exception class. But if the number of these export errors increases, it will increase the assembly code. ....
Read more

Performance tip about List


If we want to maintain a list of data, the first way that comes to mind is List or Array. In this article, we want to review a point about the space occupied by List. The List class uses an internal array to store elements. ....
Read more

Dapper does cache the query strings


When you use Dapper to read information, add information, etc., in the Dapper library, your written query is stored in a ConcurrentDictionary, so that if the same query is run again, the process to run the query again will not run. ....
Read more

Eliding async await


Normally, methods written async do not run faster than sync methods and only allow the system to respond to more requests. This topic was presented in the article How Thread pool works. ....
Read more

Wrong exception line number in stack trace in release mode


A few days ago, in one of the projects I was working on, an Object reference not set to an instance of an object error was issued, and the line where the error was issued was line 61 in the logs. When I checked line 61 ....
Read more

The difference between throw and throw ex


throw, reissues the error with the same StackTrace as before. issues exactly the same error as before. But if you use throw ex, it still issues the same error as before, but with one difference, it resets StackTrace! For example ....
Read more

The difference between async and sync


In the previous article, how the Thread Pool works was presented. In this article, we will examine the differences between async and sync methods, what is the difference between these two types, and why we should use async methods. When you write a method in sync ....
Read more

How Thread pool works in C#


When a request sent to asp.net application A thread is created to handle the request. When a thread is created, some resources such as memory are allocated to the thread. Finally, when the job is done, Garbage Collector destroys the object created for the thread ....
Read more

How to use implicit operator and explicit operator in C#


In C#, you can not normally convert or cast classes into an int variable or any other variable, and vice versa. By default, you cannot assign an int number to a class. But you can do this by using implicit operators and explicit operators ....
Read more