Example #1
0
 public static PointCut SetByIndex(this PointCut pc, TypeReference elementType, int index, Action <PointCut> value)
 {
     pc = pc.Append(pc.CreateInstruction(OpCodes.Ldc_I4, index));
     value(pc);
     pc = pc.Append(pc.CreateInstruction(GetStoreOpcode(elementType)));
     return(pc);
 }
Example #2
0
        public static PointCut CreateArray(this PointCut pc, TypeReference elementType, params Action <PointCut>[] elements)
        {
            pc = pc.Append(pc.CreateInstruction(OpCodes.Ldc_I4, elements.Length));
            pc = pc.Append(pc.CreateInstruction(OpCodes.Newarr, elementType));

            for (var i = 0; i < elements.Length; i++)
            {
                pc = pc.Append(pc.CreateInstruction(OpCodes.Dup));
                SetByIndex(pc, elementType, i, elements[i]);
            }

            return(pc);
        }
Example #3
0
 public static PointCut GetByIndex(this PointCut pc, TypeReference elementType, int index)
 {
     pc = pc.Append(pc.CreateInstruction(OpCodes.Ldc_I4, index));
     pc = pc.Append(pc.CreateInstruction(GetLoadOpcode(elementType)));
     return(pc);
 }