本文整理汇总了C#中Binder.SelectMethod方法的典型用法代码示例。如果您正苦于以下问题:C# Binder.SelectMethod方法的具体用法?C# Binder.SelectMethod怎么用?C# Binder.SelectMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Binder
的用法示例。
在下文中一共展示了Binder.SelectMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMethodImpl
protected sealed override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
Debug.Assert(name != null);
// GetMethodImpl() is a funnel for two groups of api. We can distinguish by comparing "types" to null.
if (types == null)
{
// Group #1: This group of api accept only a name and BindingFlags. The other parameters are hard-wired by the non-virtual api entrypoints.
Debug.Assert(binder == null);
Debug.Assert(callConvention == CallingConventions.Any);
Debug.Assert(modifiers == null);
return LowLevelTypeExtensions.GetMethod(this, name, bindingAttr);
}
else
{
if (!OnlySearchRelatedBitsSet(bindingAttr)) // We don't yet have proper handling for BindingFlags not related to search so throw rather return a wrong result.
throw new NotImplementedException();
// Group #2: This group of api takes a set of parameter types and an optional binder.
if (callConvention != CallingConventions.Any)
throw new NotImplementedException();
if (binder == null)
binder = Type.DefaultBinder;
MethodInfo[] candidates = LowLevelTypeExtensions.GetMethods(this, name, bindingAttr);
return (MethodInfo)binder.SelectMethod(bindingAttr, candidates, types, modifiers);
}
}
示例2: GetConstructorImpl
protected sealed override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
Debug.Assert(types != null);
if (callConvention != CallingConventions.Any)
throw new NotImplementedException();
if (!OnlySearchRelatedBitsSet(bindingAttr)) // We don't yet have proper handling for BindingFlags not related to search so throw rather return a wrong result.
throw new NotImplementedException();
if (binder == null)
binder = Type.DefaultBinder;
ConstructorInfo[] candidates = GetConstructors(bindingAttr);
return (ConstructorInfo)binder.SelectMethod(bindingAttr, candidates, types, modifiers);
}