/src/LinFu.AOP/InstructionProvider.cs
http://github.com/philiplaureano/LinFu · C# · 27 lines · 16 code · 2 blank · 9 comment · 0 complexity · 7228917681ec013df7b2357e3f577cd5 MD5 · raw file
- using System.Collections.Generic;
- using LinFu.AOP.Cecil.Interfaces;
- using Mono.Cecil;
- using Mono.Cecil.Cil;
- namespace LinFu.AOP.Cecil
- {
- /// <summary>
- /// Represents the default implementation of the <see cref="IInstructionProvider" /> class.
- /// </summary>
- internal class InstructionProvider : IInstructionProvider
- {
- /// <summary>
- /// Determines the instructions for a given method.
- /// </summary>
- /// <param name="method">The source method that contains the instructions.</param>
- /// <returns>The set of instructions for the given method.</returns>
- public IEnumerable<Instruction> GetInstructions(MethodDefinition method)
- {
- // Save the old instructions
- var oldInstructions = new LinkedList<Instruction>();
- foreach (Instruction instruction in method.Body.Instructions) oldInstructions.AddLast(instruction);
- return oldInstructions;
- }
- }
- }