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

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