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


C# PropertyInfo.Select方法代码示例

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


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

示例1: ArraySort

 public static PropertyInfo[] ArraySort(PropertyInfo[] properties)
 {
     properties = properties.Select(x => new { Property = x })
         .OrderBy(x => x.Property.Name != null ? x.Property.Name : Constants.NotApplicable)
         .Select(x => x.Property)
         .ToArray();
     return properties;
 }
开发者ID:OfficeDev,项目名称:PnP-Transformation,代码行数:8,代码来源:ArrayUtility.cs

示例2: RequireAll

		public static PropertySet[] RequireAll(ComponentModel model, PropertyInfo[] properties,
		                                       PropertySetBuilder propertySetBuilder)
		{
			return properties.Select(p => propertySetBuilder(p, false)).ToArray();
		}
开发者ID:rtr0mdrn,项目名称:Windsor,代码行数:5,代码来源:StandardPropertyFilters.cs

示例3: BuildRegistration

        public IResourceTypeRegistration BuildRegistration(Type type, string resourceTypeName = null,
            Func<ParameterExpression, string, BinaryExpression> filterByIdFactory = null,
            Func<ParameterExpression, Expression> sortByIdFactory = null,
            PropertyInfo[] includeRelationships = null)
        {
            if (resourceTypeName == null)
                resourceTypeName = _namingConventions.GetResourceTypeNameForType(type);

            var fieldMap = new Dictionary<string, ResourceTypeField>();

            var idProperty = CalculateIdProperty(type);
            if (idProperty == null)
                throw new InvalidOperationException(String.Format(
                    "Unable to determine Id property for type `{0}`.", type.Name));

            var props = type.GetProperties().OrderBy(p => p.Name);
            foreach (var prop in props)
            {
                if (prop == idProperty) continue;

                var ignore = prop.CustomAttributes.Any(c => c.AttributeType == typeof (JsonIgnoreAttribute));
                if (ignore) continue;

                var property = CreateResourceTypeField(prop);
                var jsonKey = property.JsonKey;

                if (jsonKey == "id")
                    throw new InvalidOperationException(
                        String.Format(
                            "Failed to register type `{0}` because it contains a non-id property that would serialize as \"id\".",
                            type.Name));

                if (jsonKey == "type")
                    throw new InvalidOperationException(
                        String.Format(
                            "Failed to register type `{0}` because it contains a property that would serialize as \"type\".",
                            type.Name));

                if (fieldMap.ContainsKey(jsonKey))
                    throw new InvalidOperationException(
                        String.Format(
                            "Failed to register type `{0}` because contains multiple properties that would serialize as `{1}`.",
                            type.Name, jsonKey));

                fieldMap[jsonKey] = property;
            }

            if (filterByIdFactory == null)
            {
                filterByIdFactory = (param, id) =>
                {
                    var propertyExpr = Expression.Property(param, idProperty);
                    var idExpr = Expression.Constant(id);
                    return Expression.Equal(propertyExpr, idExpr);
                };
            }

            if (sortByIdFactory == null)
            {
                sortByIdFactory = param => Expression.Property(param, idProperty);
            }

            var allincludeRelationships = new List<string>();

            if (includeRelationships != null)
            {
                allincludeRelationships.AddRange(includeRelationships.Select(CreateResourceTypeField).Select(property => property.JsonKey));
            }

            return new ResourceTypeRegistration(type, idProperty, resourceTypeName, fieldMap, filterByIdFactory,
                sortByIdFactory, allincludeRelationships.ToArray());
        }
开发者ID:SathishN,项目名称:JSONAPI.NET,代码行数:72,代码来源:ResourceTypeRegistrar.cs

示例4: Default

		public static PropertySet[] Default(ComponentModel model, PropertyInfo[] properties,
		                                    PropertySetBuilder propertySetBuilder)
		{
			return properties.Select(p => propertySetBuilder(p, true)).ToArray();
		}
开发者ID:rtr0mdrn,项目名称:Windsor,代码行数:5,代码来源:StandardPropertyFilters.cs

示例5: Line

 private string Line(PropertyInfo[] properties, Object item)
 {
     return String.Join("\t", properties.Select(prop => prop.GetValue(item, null)));
 }
开发者ID:wallymathieu,项目名称:isop,代码行数:4,代码来源:TableFormatter.cs

示例6: Header

 private string Header(PropertyInfo[] properties)
 {
     return String.Join("\t", properties.Select(prop => prop.Name));
 }
开发者ID:wallymathieu,项目名称:isop,代码行数:4,代码来源:TableFormatter.cs

示例7: GetPropertyExpressions

 private IEnumerable<Expression> GetPropertyExpressions(PropertyInfo[] properties)
 {
     return properties.Select(this.GetPropertyExpression);
 }
开发者ID:khellang,项目名称:SimpleInjector,代码行数:4,代码来源:PropertyInjectionHelper.cs

示例8: AssignListParameter

    /// <summary>
    /// If command has a ListParameter, assign unmatched  values from <c>numbered</c> to it.
    /// </summary>
    /// <param name="cmd">The command</param>
    /// <param name="properties">The command properties</param>
    /// <param name="numbered">Unmatched parameteres from ExtractParameters call</param>
    private void AssignListParameter(ICommand cmd, PropertyInfo[] properties, string[] numbered)
    {
      var listProperty = properties.FirstOrDefault(p => CommandInspector.GetListParameter(p) != null);
      if (listProperty == null)
        return;

      var numberedParameters = properties.Select(CommandInspector.GetNumberedParameter)
                         .Where(p => p != null)
                         .Select(p => p.Number);

      int numberedParametersToSkip = (numberedParameters.Any()) ? numberedParameters.Max() + 1 : 0;
      var list = numbered.Skip(numberedParametersToSkip).ToList();
      list = (from element in list
        select Parser.PerformSubstitution(_context, element)).ToList();
#if NET45
      listProperty.SetValue(cmd, list);
#else
      listProperty.SetValue(cmd, list, null);
#endif
    }
开发者ID:KerwinMa,项目名称:revolver,代码行数:26,代码来源:CommandHandler.cs

示例9: GetChainName

 public static string GetChainName(PropertyInfo[] chain)
 {
     return String.Join (".", chain.Select (p => p.Name));
 }
开发者ID:QualitySolution,项目名称:GammaBinding,代码行数:4,代码来源:PropertyChainFromExp.cs


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