Showing posts with label csharp. Show all posts
Showing posts with label csharp. Show all posts

31 July 2017

How are C# Local Functions Implemented?

One of the new features in C# 7 is local functions. They provide a more intuitive syntax over creating verbose System.Func delegates, as well as being more capable (they support ref and out parameters, async, generics, etc). I also read that local functions compile down to normal methods, thus reducing GC allocations when compared to System.Func.

8 May 2017

Exploring Multiple Dispatch in C# with BenchmarkDotNet

A few years ago, Jakub Chodounský made an excellent post about Dynamic Dispatch in C#. He discussed the relations between static, dynamic, single, and multiple dispatch, and covered a few ways to get Multiple Dispatch behavior in C#: