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


C# Binder.SelectMethod方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:adityamandaleeka,项目名称:corert,代码行数:27,代码来源:RuntimeTypeInfo.BindingFlags.cs

示例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);
        }
开发者ID:adityamandaleeka,项目名称:corert,代码行数:15,代码来源:RuntimeTypeInfo.BindingFlags.cs


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