public static Instruction GetPreviousInstruction(this IList<Instruction> instructions, Instruction instruction) { var currentIndex = instructions.IndexOf(instruction); if (currentIndex <= 0) { return null; } return instructions[currentIndex - 1]; }