Taking a closer look at the CompilerServices Unsafe approach to unsafe reference arithmetic over fixed statement in .NET. .NET has a garbage collector (GC) that automates memory management. This is incompatible with working with direct memory pointers, since the GC needs to track object usage and move objects around when required. You are of course free to allocate… Read More »
In .Net memory access is safe by default. This means that every time you access an array item the index is checked against the length of the array. In this post I explore how you can speed up plain old array access 18%-34% by convincing the compiler it can skip some checks. I compile the C# code down… Read More »
If you have used async/await, but feel some details are still a bit fuzzy then this may be for you. I thought I’d hop down into the rabbit hole and give some examples of how async/await actually works. Hopefully this will provide some understanding and get you further on your journey to become an expert. Async/await is a… Read More »
Response cache is fine for simpler operations, but sometimes you need more fine grained control. System.Runtime.Caching.MemoryCache has builtin support for in-memory cache with expiry.
ASP.NET Core comes with built-in support for response caching. Unlike cache-control header that tells client/proxies how long to cache data, the response cache will cache output of an action.
Whether writing stand alone application or web application you may want to put database related code into a separate project. I find it good for separating concerns.
Swagger makes the API machine readable. This means documentation and client implementations can be produced automatically. Swashbuckle runs top of Swagger and provides an UI. Together they provide nice functionality for documenting and testing your API.
With API’s often changing over time you may want to plan for versioning early on. ASP.NET Core has a library that makes versioning API a bit easier. By tagging controllers and actions with version number one can run multiple versions simultaneously.