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


C# MethodInfo.GetAttributes方法代码示例

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


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

示例1: MethodSpec

        public MethodSpec(MethodInfo methodInfo)
        {
            MethodInfo = methodInfo;

            var methodName = methodInfo.Name.Replace("_", "(.*)");
            MethodPatternName = methodName.RemoveAccents().SplitCamelCase();

            ParameterCollection = methodInfo.GetParameters().ToList();
            ConvertAttributeCollection = methodInfo.GetAttributes<ParameterConvertAttribute>();
        }
开发者ID:Diullei,项目名称:NetSpec,代码行数:10,代码来源:MethodSpec.cs

示例2: ScriptAction

 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptAction"/> class.
 /// </summary>
 /// <param name="method">The method.</param>
 public ScriptAction(MethodInfo method, Type type)
 {
     this.Method = method;
     this.ActionClass = type;
     this.Title = method.GetAttribute<ActionTitle>();
     this.Config = method.GetAttribute<ActionConfig>();
     this.Examples = method.GetAttribute<ActionExamples>();
     this.Params = method.GetAttributes<ActionParameter>();
     if (this.Params != null) { this.Params = (from pr in this.Params orderby pr.Index ascending select pr).ToArray(); }
 }
开发者ID:alexisjojo,项目名称:ktibiax,代码行数:14,代码来源:ScriptAction.cs

示例3: DefineOverrideMethod

 private static MethodBuilder DefineOverrideMethod(this TypeBuilder typeBuilder, MethodInfo method)
 {
     var builder = typeBuilder.DefineMethod(method.Name, method.GetAttributes(), method.CallingConvention, method.ReturnType, method.GetParameterTypes().ToArray());
     if (method.IsGenericMethod)
     {
         return builder.DefineGeneric(method);
     }
     return builder;
 }
开发者ID:FarseerNet,项目名称:Farseer.Net.DI,代码行数:9,代码来源:DynamicHelper.cs

示例4: OperationDescriptor

        internal OperationDescriptor(MethodInfo method, string operationName, IServiceDescriptor serviceDescriptor)
        {
            Extensions = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
            Method = method;
            ParameterNames = method.GetParameters().Select(p => p.Name).ToArray();
            OperationName = operationName;
            ServiceDescriptor = serviceDescriptor;
            Executor = method.GetFunc();
            NameSelector = method.GetAttribute<OperationNameSelectorAttribute>(true);
            MethodSelector = method.GetAttribute<OperationSelectorAttribute>(true);
            Filters = method.GetAttributes<OperationFilterAttribute>(true).Distinct().ToArray();
            Bindings = method.GetParameters().Select(p => new BindingInfo( p)).ToArray();

            var descAttr = Method.GetAttribute<DescriptionAttribute>(true);
            if (descAttr != null)
                Description = descAttr.Description;
        }
开发者ID:netcasewqs,项目名称:nlite,代码行数:17,代码来源:OperationDescriptor.cs

示例5: CreateAction

        /// <summary>
        /// Creates the action.
        /// </summary>
        /// <param name="targetType">Type of the target.</param>
        /// <param name="targetFilters">The target filters.</param>
        /// <param name="methodInfo">The method info.</param>
        /// <returns>The action.</returns>
        protected virtual IAction CreateAction(Type targetType, IFilterManager targetFilters, MethodInfo methodInfo)
        {
            var builder = methodInfo.GetAttributes<IActionFactory>(true)
                              .FirstOrDefault() ?? new ActionAttribute();

            return builder.Create(
                new ActionCreationContext(
                    serviceLocator,
                    methodFactory,
                    messageBinder,
                    conventionManager,
                    targetType,
                    targetFilters,
                    methodInfo
                    )
                );
        }
开发者ID:ssethi,项目名称:TestFrameworks,代码行数:24,代码来源:DefaultActionLocator.cs


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