Beispiel #1
0
 internal MethodCopier(MethodBase fromMethod, ILGenerator toILGenerator, LocalBuilder[] existingVariables = null)
 {
     if (fromMethod == null)
     {
         throw new ArgumentNullException("Method cannot be null");
     }
     reader = new MethodBodyReader(fromMethod, toILGenerator);
     reader.DeclareVariables(existingVariables);
     reader.ReadInstructions();
 }
Beispiel #2
0
        internal static List <ILInstruction> GetInstructions(ILGenerator generator, MethodBase method)
        {
            if (method == null)
            {
                throw new ArgumentNullException("Method cannot be null");
            }
            var reader = new MethodBodyReader(method, generator);

            reader.DeclareVariables(null);
            reader.ReadInstructions();
            return(reader.ilInstructions);
        }