예제 #1
0
            public ReadOnlyCollection <IPropertyBase> GetAllProperties(bool includeInheritance)
            {
                if (!includeInheritance)
                {
                    return(base.GetAllProperties(false));
                }

                var inheritanceTree = InheritanceTreeCache.Get(this);
                var distinctByName  = new IdentityProjectionEqualityComparer
                                      <IPropertyBase, string>(property => property.Name);
                var inheritanceList =
                    inheritanceTree.GetFlatList(InheritanceListMode.WholeTree).Select(node => node.Interface);
                var result = (from item in inheritanceList
                              select item.AllProperties).SelectMany(list => list).Distinct(distinctByName);

                return(new ReadOnlyCollection <IPropertyBase>(result.ToList()));
            }
예제 #2
0
파일: Interface.cs 프로젝트: psulek/doemd
        public override ReadOnlyCollection <IPropertyBase> GetAllProperties(bool includeInheritance)
        {
            if (!includeInheritance)
            {
                return(base.GetAllProperties(false));
            }

            var inheritanceTree = InheritanceTreeCache.Get(this);
            var distinctByName  = new IdentityProjectionEqualityComparer
                                  <IPropertyBase, string>(property => property.Name);
            var flatList        = inheritanceTree.GetFlatList(InheritanceListMode.WholeTree);
            var inheritanceList = flatList.Reverse().Select((node, i) => new { pos = i, @interface = node.Interface });
            var allProps        = (from item in inheritanceList
                                   orderby item.pos
                                   select [email protected]).SelectMany(list => list).Concat(this.AllProperties);
            var result = allProps.Distinct(distinctByName).ToList();

            return(new ReadOnlyCollection <IPropertyBase>(result));
        }