本文整理汇总了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);
}