Angular 5 – download file with authentication

Source: This article describes how a typical browser file download can be triggered using the Angular HttpClient. Typically you can simply introduce a link to the endpoint of the file download into the page and this will work just fine. However, if you use authentication via bearer token etc. and the download endpoint needs authentication, you probably want to use … Read moreAngular 5 – download file with authentication

Understanding c# ConcurrentDictionary A thread-safe collection vs. a non-threadsafe-collection can be looked upon in a different way. Consider a store with no clerk, except at checkout. You have a ton of problems if people don’t act responsibly. For instance, let’s say a customer takes a can from a pyramid-can while a clerk is currently building … Read moreUnderstanding c# ConcurrentDictionary

What is c# where T constraint

I saw some code using where T syntax. Where T is a constraint – I wrote next (although not very useful example, just for demonstration) example: public interface IBaseModel { string Message { get; set; } } public class ApiResponseMessage : IBaseModel { public string Message { get => throw new NotImplementedException(); set => throw … Read moreWhat is c# where T constraint

Inside the Concurrent Collections: ConcurrentDictionary

Source: Using locks to implement a thread-safe collection is rather like using a sledgehammer – unsubtle, easy to understand, and tends to make any other tool redundant. Unlike the previous two collections I looked at, ConcurrentStack and ConcurrentQueue, ConcurrentDictionary uses locks quite heavily. However, it is careful to wield locks only where necessary to ensure that concurrency is maximised. This … Read moreInside the Concurrent Collections: ConcurrentDictionary

The .NET Dictionary

Source: To many people, System.Collections.Generic.Dictionary<TKey,TValue> is just a useful collection. In this post, I’ll be looking inside that collection and see how it really works. Dictionary is based on a hashtable; for the rest of this post, I’ll assume you know roughly how a hashtable works. The Wikipedia article, as the source of all knowledge algorithmical, provides a good … Read moreThe .NET Dictionary

Inversion of Control

Source:   An introduction to Inversion of Control, using the Dependency Injection and Service Locator patterns, with simple examples in C#. Lately I’ve been giving a couple of presentations on the subject of automated testing of websites. According to myself and the feedback I’ve gotten one of the most important parts of the presentations has been … Read moreInversion of Control