static internal byte[] GetBodyAsByteArray(this MethodBase method) { method.Prepare(); if (method is DynamicMethod) { return((method as DynamicMethod).GetILGenerator().GetILAsByteArray()); } var _body = method.GetMethodBody(); return(_body == null ? null : _body.GetILAsByteArray()); }