예제 #1
0
 public static ParsedMethodBody GetParsedMethodBody(this ConstructorInfo constructor)
 => ParsedMethodBody
 .Create
 (
     constructor,
     GetInstructionsFromILByteArray
     (
         constructor.GetMethodBody().GetILAsByteArray(),
         constructor.Module,
         constructor.ReflectedType.GetGenericArguments(),
         Type.EmptyTypes
     ).ToArray()
 );
예제 #2
0
 public static Option <ParsedMethodBody> GetParsedMethodBody(this MethodInfo method)
 => Option
 .FromNullable(method.GetMethodBody())
 .Map(methodBody => GetInstructionsFromILByteArray(methodBody.GetILAsByteArray(), method.Module, method.ReflectedType.GetGenericArguments(), method.GetGenericArguments()))
 .Map(instructions => ParsedMethodBody.Create(method, instructions.ToArray()));