/// <summary> /// Declare the local variables used in the new method. /// </summary> private void DeclareLocalVariableTypes(ILGenerator generator, MethodBodyReader reader) { List <Type> locals = reader.GetLocalTypes(); // Declare all the local variable types. foreach (Type type in locals) { generator.DeclareLocal(type); } }