Tag Archives: c#

C# Behind the scenes – Local Functions

The second “Behind the scenes” article, will be about local function. This is much simple from previous post about yield keyword. In short, local function translated to a method of the class. Example 1

Posted in .NET, c# | Tagged , , , | 1 Comment

C# Behind the scenes – `yield`

The first “Behind the scenes” article will be about yield keyword. Lets take for example a very simple code that return numbers 1,2,3: The compiler translates this 4 lines code into an entire class.

Posted in .NET, c# | Tagged , , , , | 1 Comment

C# Behind the scenes

I see a lot of beginners programmers, but certainly not just beginners, who are not sure how things work in C#. I’m not talking about the CLR but about the language itself. And mostly specific on all sorts of keywords … Continue reading

Posted in .NET, c# | Tagged , , | 2 Comments

Mono.Cecil – Generics

Till now we saw an overview on Cecil and two simple examples. Today I want to show how you can handle generics in Cecil. For the example I’m going to use EqualityComparer<>

Posted in .NET, c# | Tagged , , , | Leave a comment

Value type methods – call, callvirt, constrained and hidden boxing

Long time ago I wrote a post here on  call vs callvirt and the needed of the this null check. Here I want to wrote about this topic but on value types. Look on these three ToString() calls:

Posted in .NET, c#, Roslyn | Tagged , , , , , , , | Leave a comment

Make method static with Roslyn

Before Roslyn days, this was not easy to do that, like others re factoring. Fortunately we have R# for this. But now it’s not so hard to re factor an instance method into static method. I wrote a rewriter that … Continue reading

Posted in .NET, c#, Roslyn | Tagged , , , , , | Leave a comment