Adapter Design Pattern In C#

#242 – January 20, 2019

sponsor

Find A Job Through Vettery

Vettery specializes in tech roles and is completely free for job seekers. How does it work? You apply to join the platform, and once accepted, you’ll start receiving interview requests directly from top companies growing their tech teams. You decide which interviews you want to take, all from the comfort of your inbox!

this week's favorite

Adapter Design Pattern In C#

The Adapter design pattern is one of the most common, and most useful patterns available to us as software developers. When you have a class that needs to utilize a particular interface, and you have a library that includes the functionality you need, but it doesn’t use the interface that you require. You can achieve the reuse of that library’s code by creating an Adapter class that sits between your client code, and the code that’s in this library, and adapts one interface to the other.

C# 8: Type Inference for the New Keyword

In many situations, there is only one possible type allowed in a given place. And yet C# still requires you to explicitly list the type. If the Target-typed `new` expression proposal is adopted, such boilerplate code will no longer be necessary.

Managed pointers in .NET

Most of the time a regular .NET developer uses object references and it is simple enough because this is how a managed world is constructed – objects are referencing each other via object references. An object reference is, in fact, a type-safe pointer (address) that always points to an object MethodTable reference field (it is often said it points at the beginning of an object). Thus, using them may be quite efficient. Having an object reference, we simply have the whole object address. For example, the GC can quickly access its header via constant offset. Addresses of fields are also easily computable due to information stored in MethodTable.

Performance Tuning for .NET Core

Some of you may know I've been spending whatever time I can scrounge together grinding away at a new serialization library for .NET. Serializers can be complicated beasts. They have to be reliable, flexible, and fast beyond reproach. I won't convince you that serialization libraries have to be quick — in this post, that's a given. These are some tips from my experience in optimizing Hagar's performance. Most of this advice is applicable to other types of libraries or applications.

Stopping Garbage Collection in .NET Core 3.0 (part I)

You have an application or a particular code path of your application that cannot take the pauses that GC creates. Typical examples are real time systems, tick by tick financial apps, embedded systems, etc …

newsletters