I've come across dynamic methods a little in reflection-based C# code, and I'm yet to figure out precisely what they are. There specifically seems to be a DynamicMethod
class that allows the generation and specification of CLR methods at runtime. But then there's also the MethodBuilder
class. They both seem to do very similar things. Apparently "dynamic assemblies" are AssemblyBuilder
classes and "dynamic types" are TypeBuilder
classes. They all reside in the System.Reflection.Emit
namespace in any case.
MSDN seems to have precious little high-level information on this subject. So if someone could explain what dynamic methods are, where exactly all the XYZBuilder
classes come into play here, and what they're each used for, that would be great. Any other Reflection.Emit types and functionality I should know about would be appreciated too.