Example #1
0
        private static PropertyInfoContainer GetPropertiesFor(Type type, IPropertyInfoFetcher fetcher)
        {
            var immediateProperties = fetcher.GetProperties(type, SEEK_FLAGS);
            var interfaceProperties = type.GetAllImplementedInterfaces()
                                      .Select(itype => fetcher.GetProperties(itype, SEEK_FLAGS))
                                      .SelectMany(p => p);
            var all = immediateProperties.Union(interfaceProperties).ToArray();

            return(new PropertyInfoContainer(all));
        }
Example #2
0
        private void StaticallyCachePropertInfosFor(Type interfaceToMimick)
        {
            var bindingFlags = BindingFlags.Instance | BindingFlags.FlattenHierarchy | BindingFlags.Public;

            _mimickedPropInfos = new PropertyInfoContainer(
                interfaceToMimick.GetAllImplementedInterfaces()
                .Select(i => _propertyInfoFetcher
                        .GetProperties(i, bindingFlags))
                .SelectMany(c => c)
                .ToArray()
                );
        }