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


C# PropertyInfo.Where方法代码示例

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


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

示例1: FindAttachedModelProperty

		public PropertyInfo FindAttachedModelProperty(PropertyInfo queryProperty, PropertyInfo[] modelProperties)
		{
			var queryPropertyName = queryProperty.Name;
			if (queryProperty.PropertyType != typeof (string)) return null;
			if (!queryPropertyName.EndsWith(Suffix)) return null;
			return
				modelProperties.Where(o => o.PropertyType == typeof (string))
				               .FirstOrDefault(modelProperty => queryPropertyName == modelProperty.Name + Suffix);
		}
开发者ID:tianzhiyuan,项目名称:agile,代码行数:9,代码来源:StringContainsAnalyzer.cs

示例2: MapIdentifier

        private IdentifierMap MapIdentifier(PropertyInfo[] properties)
        {
            PropertyInfo id = properties.Where(x => x.Name.Equals(DefaultIdentifier)).FirstOrDefault();

            if (id == null)
            {
                throw new MappingException("Entity does not contain an identifier [Id].");
            }

            return new IdentifierMap(id, id.Name, id.PropertyType);
        }
开发者ID:trentcioran,项目名称:SimpleORM,代码行数:11,代码来源:ClassMapper.cs

示例3: GetEnumerableIndexablePropertyInfos

        protected virtual PropertyInfo[] GetEnumerableIndexablePropertyInfos(PropertyInfo[] properties, IStructureProperty parent = null, ICollection<string> nonIndexablePaths = null, ICollection<string> indexablePaths = null)
        {
            if (properties.Length == 0)
                return new PropertyInfo[0];

            var filteredProperties = properties.Where(p =>
                !p.PropertyType.IsSimpleType() &&
                p.PropertyType.IsEnumerableType() &&
                !p.PropertyType.IsEnumerableBytesType());

            if (nonIndexablePaths != null && nonIndexablePaths.Any())
                filteredProperties = filteredProperties.Where(p => !nonIndexablePaths.Contains(
                    PropertyPathBuilder.BuildPath(parent, p.Name)));

            if (indexablePaths != null && indexablePaths.Any())
                filteredProperties = filteredProperties.Where(p => indexablePaths.Contains(
                    PropertyPathBuilder.BuildPath(parent, p.Name)));

            return filteredProperties.ToArray();
        }
开发者ID:kukubadze,项目名称:SisoDb-Provider,代码行数:20,代码来源:StructureTypeReflecter.cs

示例4: GetAuditedProperties

 /// <summary>
 /// 
 /// </summary>
 /// <param name="properties"></param>
 /// <returns></returns>
 private static IEnumerable<PropertyInfo> GetAuditedProperties(PropertyInfo[] properties)
 {
     return properties.Where(x => x.GetCustomAttribute<ParentAuditedAttribute>(false) != null);
 }
开发者ID:truller2010,项目名称:Diversia,代码行数:9,代码来源:KotikoBlogS2AuditEventListener.cs

示例5: RequireBase

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

示例6: GetPropertyNames

        private List<string> GetPropertyNames(PropertyInfo[] properties)
        {
            List<string> result = new List<string>();

            List<PropertyInfo> props = properties.Where(p => p.Name.EndsWith("RepetitionsUsed")).ToList();
            foreach (PropertyInfo p in props)
                result.Add(p.Name.Remove(p.Name.IndexOf("RepetitionsUsed")));

            return result;
        }
开发者ID:mrgoodman2014,项目名称:NHapiTools,代码行数:10,代码来源:Generator.cs

示例7: Prune

        private void Prune(IContentTypeBase contentType, Type documentClrType, PropertyInfo[] tabProperties, IEnumerable<PropertyInfo> propertiesOfRoot)
        {
            bool modified = false;

            var propertiesToKeep = propertiesOfRoot.Where(x =>
            {
                var attr = x.DeclaringType.GetCodeFirstAttribute<CodeFirstCommonBaseAttribute>(false);
                return x.DeclaringType == documentClrType || attr != null;
            }).Select(x => x.GetCodeFirstAttribute<ContentPropertyAttribute>().Alias)
            .Union(tabProperties.Where(x =>
            {
                var attr = x.DeclaringType.GetCodeFirstAttribute<CodeFirstCommonBaseAttribute>(false);
                return x.DeclaringType == documentClrType || attr != null;
            }).SelectMany(x =>
            {
                return x.PropertyType.GetProperties().Where(y =>
                {
                    return (y.DeclaringType == x.PropertyType || y.DeclaringType.GetCodeFirstAttribute<CodeFirstCommonBaseAttribute>(false) != null) && y.GetCodeFirstAttribute<ContentPropertyAttribute>() != null;
                }).Select(y =>
                    {
                      var attr = y.GetCodeFirstAttribute<ContentPropertyAttribute>();
                      var tabAttr = x.GetCodeFirstAttribute<ContentTabAttribute>();
                      return attr.AddTabAliasToPropertyAlias ? attr.Alias + "_" + tabAttr.Name.Replace(" ", "_") : attr.Alias;
                    });
            })).ToList();

            propertiesToKeep.AddRange(documentClrType.GetCustomAttributes<DoNotRemovePropertyAttribute>(true).Select(x => x.PropertyAlias));

            //loop through all the properties on the ContentType to see if they should be removed.
            var existingUmbracoProperties = contentType.PropertyTypes.ToArray();
            int length = contentType.PropertyTypes.Count();
            for (int i = 0; i < length; i++)
            {
                if (!propertiesToKeep.Any(x => x.Equals(existingUmbracoProperties[i].Alias, StringComparison.InvariantCultureIgnoreCase)))
                {
                    if (contentType.PropertyTypeExists(existingUmbracoProperties[i].Alias))
                    {
                        modified = true;
                        //remove the property
                        contentType.RemovePropertyType(existingUmbracoProperties[i].Alias);
                        var alias = existingUmbracoProperties[i].Alias;
                        var children = GetChildren(contentType);

                        //TODO is this needed? I reckon it shouldn't be
                        RemovePropertyFromChildren(alias, children);
                    }
                }
            }

            if (modified)
            {
                contentType.ResetDirtyProperties(false);
                Save(contentType);
            }
        }
开发者ID:DanMannMann,项目名称:UmbracoCodeFirst,代码行数:55,代码来源:ContentTypeModuleBase.cs


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