コード例 #1
0
        private IEnumerable <PropertyItem> CollectProperties(object[] components)
        {
            if (components == null || components.Length == 0)
            {
                throw new ArgumentNullException(nameof(components));
            }

            // TODO: PropertyItem is to be wired with PropertyData rather than pure PropertyDescriptor in the next version!
            var descriptors = (components.Length == 1)
              ? MetadataRepository.GetProperties(components[0]).Select(prop => prop.Descriptor)
              : ObjectServices.GetMergedProperties(components);

            IList <PropertyItem> propertyCollection = new List <PropertyItem>();

            foreach (var propertyDescriptor in descriptors)
            {
                var item = CreatePropertyItem(propertyDescriptor);
                if (item != null)
                {
                    propertyCollection.Add(item);
                }
            }

            return(propertyCollection);
        }