In-Memory Code Generation at Run-Time With .NET – Part 5 – Loading

This article is split into 5 posts.

  1. Introduction
  2. Templating Engines
  3. Code Generation From Source
  4. Code Generation From Model
  5. Loading

Read More »

Reflection Emit and Type Inheritance: Calling Base Type Constructors

Suppose you want to use Reflection.Emit to generate a dynamic type in memory. Suppose this dynamic type should inherit a custom base type, and you want to put the default implementation into this base type. In plain C#, you would write…

class MyDynamic : MyBase
{
    public MyDynamic()
    {
    }
}

… but with Reflection.Emit, there’s a gotcha.Read More »

Linq Expressions By Sample: Calling Generic Methods With Lambda Parameters For Unknown Types

Suppose you need to call a generic Method that receives a generic delegate parameter. Now suppose that you neither know the type of the generic argument for the method nor the implementation of the delegate parameter at compile time. You could build a Linq Expression at runtime to solve this problem. Here’s how.Read More »