Collection initializer: List<T>
We're all used to write new List<int> { 1, 2, 3, 4 } or new int[] { 1, 2, 3, 4} to initialize collections with
values. Syntactically, they look similar, but the behavior is different, and you should be careful if you are worried
about
performance.
String of Digits
A popular task is to check if a string contains only digits. For example, you need to check if the user entered the correct phone number, index or a tax code of an organization. There are several ways to solve this task, which differ in their efficiency. Let's take a look at the most popular ones.
Any() vs Count: part 2
In Part 1, we compared Any() and Count methods for different collections and proposed optimization approaches.
Csharp (22)
.net (20)
performance (9)
benchmark (9)
LINQ (8)
collections (4)
.net6 (3)
.net8 (3)
.net48 (3)
.netcore31 (3)
MSSQL (3)
.net10 (2)
list (2)
.net9 (2)
string (2)
TSQL (2)
patterns (2)
stackoverflow (2)
HashSet (1)
dapper (1)
sql (1)
regex (1)
.net5 (1)
optimization (1)
roslyn (1)
analyzer (1)
NDepend (1)
asp.net (1)
.net471 (1)
specification (1)
repository (1)
EntityFramework (1)
xml (1)
soap (1)
CancellationToken (1)
Timer (1)
debug (1)
properties (1)
IEnumerable (1)
foreach (1)
retry (1)
circuit breaker (1)