How to tell if a .NET assembly is dynamic?

To check if the assembly is dynamic:

if (assembly.ManifestModule is System.Reflection.Emit.ModuleBuilder)

This took me a while to figure out, so here it is asked and answered.

Update:

In .NET 4.0, there is now a property:

if (assembly.IsDynamic)

Leave a Comment