当前位置: 首页>>代码示例>>C#>>正文


C# TypeDefinition.GetInjectionMethod方法代码示例

本文整理汇总了C#中TypeDefinition.GetInjectionMethod方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinition.GetInjectionMethod方法的具体用法?C# TypeDefinition.GetInjectionMethod怎么用?C# TypeDefinition.GetInjectionMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TypeDefinition的用法示例。


在下文中一共展示了TypeDefinition.GetInjectionMethod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInjector

 /// <summary>
 ///     Finds a method that could be used as an injection method (hook) for this method and constructs an instance of
 ///     <see cref="InjectionDefinition" /> from it.
 /// </summary>
 /// <param name="target">This method that is used as a target.</param>
 /// <param name="injectionType">Type that contains the injection method (hook).</param>
 /// <param name="name">Name of the injection method (hook).</param>
 /// <param name="flags">
 ///     Injection flags that specify what values to pass to the injection method and how to inject it. This
 ///     method attempts to find the hook method that satisfies all the specified flags.
 /// </param>
 /// <param name="localsID">
 ///     An array of indicies of local variables to pass to the injection method. Used only if
 ///     <see cref="InjectFlags.PassLocals" /> is specified, otherwise ignored.
 /// </param>
 /// <param name="typeFields">
 ///     An array of class fields from the type the target lies in to pass to the injection method.
 ///     Used only if <see cref="InjectFlags.PassFields" /> is specified, otherwise ignored.
 /// </param>
 /// <returns>
 ///     An instance of <see cref="InjectionDefinition" />, if a suitable injection method is found from the given
 ///     type. Otherwise, null.
 /// </returns>
 public static InjectionDefinition GetInjector(this MethodDefinition target,
                                               TypeDefinition injectionType,
                                               string name,
                                               InjectFlags flags = InjectFlags.None,
                                               int[] localsID = null,
                                               params FieldDefinition[] typeFields)
 {
     return injectionType.GetInjectionMethod(name, target, flags, localsID, typeFields);
 }
开发者ID:denikson,项目名称:Mono.Cecil.Inject,代码行数:32,代码来源:MethodDefinitionExtensions.cs


注:本文中的TypeDefinition.GetInjectionMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。