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


C# ParameterInfo.Any方法代码示例

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


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

示例1: HasOneParameterNeeded

 private bool HasOneParameterNeeded(ParameterInfo[] parameters, TypeInfo eventArgsType)
 {
     return parameters.Any() &&
            parameters.ElementAt(0).ParameterType.GetTypeInfo().IsAssignableFrom(eventArgsType);
 }
开发者ID:aaronpowell,项目名称:Bob,代码行数:5,代码来源:EventToDataContextMethod.cs

示例2: IsValidCommandHandler

 private static bool IsValidCommandHandler(Type commandType, MethodInfo method, ParameterInfo[] parameters, MethodParameterInjector injector)
 {
     if (method.DeclaringType != null && method.DeclaringType.GetProperties().Any(p => IsPropertyAccessor(method, p)))
         return false;
     return parameters.Any(p => p.ParameterType == commandType)
            && parameters.All(p => p.ParameterType == commandType || injector.CanSupply(p.ParameterType));
 }
开发者ID:jamie-davis,项目名称:ConsoleTools,代码行数:7,代码来源:CommandHandlerLoader.cs

示例3: IsUnwrapArgsNeeded

 /// <summary>
 /// Check if unwrap args is needed. If false, UnwrapArgs/WrapResult become NOP.
 /// The default implementation returns true if there is any [out] params.
 /// </summary>
 /// <param name="parameterInfos">All the parameterinfo.</param>
 /// <returns>true if UnwrapArgs/WrapResult should be performed.</returns>
 protected virtual bool IsUnwrapArgsNeeded(ParameterInfo[] parameterInfos)
 {
     return parameterInfos.Any(p => p.IsOut);
 }
开发者ID:mauroa,项目名称:NuGet.VisualStudioExtension,代码行数:10,代码来源:MethodBinder.cs

示例4: BuildParameterPath

 private static string BuildParameterPath(ParameterInfo[] parameters)
 {
     if(!parameters.Any()) return String.Empty;
     var parameterPath = Path.Combine(parameters.Select(p => $"{{{p.Name}}}").ToArray());
     return $"/{parameterPath}";
 }
开发者ID:Marvin-Brouwer,项目名称:NancyController,代码行数:6,代码来源:NancyControllerModule.cs

示例5: SetEmptyCollectionOnMethodSelect

        public static void SetEmptyCollectionOnMethodSelect(ParameterInfo[] parameters, ObservableCollection<ControlView> controlViewBindingObject, string guid)
        {
            if (parameters.Any())
            {
                foreach (ParameterInfo mParameter in parameters)
                {
                    int parameterOrder = mParameter.Position;
                    //mParameter.ParameterType

                    GetParameter(controlViewBindingObject, mParameter, parameterOrder, guid);
                }
            }
        }
开发者ID:huoxudong125,项目名称:WCFLoadUI,代码行数:13,代码来源:ControlsHelper.cs

示例6: SetCollectionOnValue

        public static void SetCollectionOnValue(Value selectedValueObj, ParameterInfo[] parameters, ObservableCollection<ControlView> controlViewBindingObject, string guid)
        {
            if (parameters.Any())
            {
                foreach (ParameterInfo mParameter in parameters)
                {
                    int parameterOrder = mParameter.Position;
                    var paramValue = (from p in selectedValueObj.Param
                                      where p.Order == parameterOrder
                                      select p).First();

                    GetParameter(controlViewBindingObject, mParameter, parameterOrder, guid, paramValue);
                }
            }
        }
开发者ID:huoxudong125,项目名称:WCFLoadUI,代码行数:15,代码来源:ControlsHelper.cs

示例7: EmitMethodWithParameterCombo

        private void EmitMethodWithParameterCombo(int thissIdx, MethodInfo realMethod, Type[] parameters, MethodBuilder methodBuilder, ParameterInfo[] realParams)
        {
            var gen = methodBuilder.GetILGenerator();
              if (!realMethod.IsStatic)
              {
            // Set 'this' to the result of JishProxy.GetInstance. This allows one
            // class to proxy to methods from different source classes.
            SetReferenceToAppropriateThis(gen, thissIdx);
              }
              for (int i = 0; i < parameters.Length; i++)
              {
            if (IsParamsArray(realParams[i]))
            {
              break;  // Break as this is the last parameter (params must always be last)
            }
            // if (IsParamDelegate(realParams[i])) // TODO: This is in the wrong place
            // {
            // If the param is a delegate it needs to be replaced with a string which
            // will be used to find the 'real' delegate in the jish_internal scope.

            // }
            // Else add standard inline arg
            gen.Emit(OpCodes.Ldarg, i + 1);
              }

              for (int i = parameters.Count(); i < realParams.Length; i++)
              {
            if (IsParamsArray(realParams[i])) break;

            gen.Emit(OpCodes.Ldarg_0);
            gen.Emit(OpCodes.Ldc_I4, thissIdx); // Load the this index into the stack for GetInstance param
            gen.Emit(OpCodes.Ldc_I4, i);
            MethodInfo getLastOptional = typeof (JishProxy).GetMethod("GetOptionalParameterDefaultValue");
            getLastOptional = getLastOptional.MakeGenericMethod(new[] {realParams[i].ParameterType});
            gen.Emit(OpCodes.Callvirt, getLastOptional);
              }
              ParameterInfo last = realParams.Any() ? realParams.Last() : null;
              if (last != null && IsParamsArray(last))
              {
            CovertRemainingParametersToArray(parameters, gen, realParams.Count() - 1, last.ParameterType.GetElementType());
              }
              // Call the real method
              gen.Emit(realMethod.IsStatic ? OpCodes.Call : OpCodes.Callvirt, realMethod);
              gen.Emit(OpCodes.Ret);
        }
开发者ID:plkumar,项目名称:jish,代码行数:45,代码来源:TypeILWrapper.cs


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