Harmful collection transformations. Part 3: collections
Starting with string
in the first post we continue to study examples with collection transformations and how they affect our applications.
Harmful collection transformations. Part 2: automatic diagnostics
The previous post contains code examples that can be simplified by removing ToArray()
or ToCharArray()
calls. And an interesting example with List<char>
constructor. But we need to be very attentive to find such places in our code. It would be much safer to do it automatically. This post shows us about automatic compiler diagnostics that can detect issues.
Harmful collection transformations. Part 1: string to array of chars
An array - the simplest collection. It's just a memory block with elements of one type. Arrays are often used when we need to iterate a collection, to search elements or transform them. C# and .net evolved, many new collections were introduced, interfaces allowed to create generalized algorithms, LINQ simplified the work of programmers, but we continue to use arrays in inappropriate places and perform excess and sometimes harmful transformations. This post begins a series about collections, their features, performance and design. All posts will contain benchmarks, code examples, my opinion and recommendations.
I want to start with a string
, some specific collection of .net.
NDepend: first overview
There are a bunch of tools that helps c#-developers write code better, more performant and with a better quality. NDepend is one of them. Here is my experience of using this tool.
ASP .NET WebApi: Model validation
You may know about ValidationAttribute. First appeared with .net framework 3.5 it is still used for validation. This article is about data model validation in ASP.NET WebApi.