當前位置: 首頁>>代碼示例>>C#>>正文


C# PropertyDescriptorCollection.OfType方法代碼示例

本文整理匯總了C#中System.ComponentModel.PropertyDescriptorCollection.OfType方法的典型用法代碼示例。如果您正苦於以下問題:C# PropertyDescriptorCollection.OfType方法的具體用法?C# PropertyDescriptorCollection.OfType怎麽用?C# PropertyDescriptorCollection.OfType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.ComponentModel.PropertyDescriptorCollection的用法示例。


在下文中一共展示了PropertyDescriptorCollection.OfType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetProperties

        public override PropertyDescriptorCollection GetProperties()
        {
            if (_properties == null) {
                // Get properties from our parent
                var originalCollection = base.GetProperties();

                // Set _properties to avoid a stack overflow when CreateProjectionProperties
                // ends up recursively calling TypeDescriptor.GetProperties on a type.
                _properties = originalCollection;

                var customDescriptorsCreated = false;
                var tempPropertyDescriptors = new List<PropertyDescriptor>();

                // for every property exposed by our parent, see if we have additional metadata to add,
                // and if we do we need to add a wrapper PropertyDescriptor to add the new attributes
                foreach (var propDescriptor in _properties.OfType<PropertyDescriptor>()) {
                    var newMetadata = GetAdditionalAttributes(propDescriptor);
                    if (newMetadata.Length > 0) {
                        tempPropertyDescriptors.Add(new DataControllerPropertyDescriptor(propDescriptor, newMetadata));
                        customDescriptorsCreated = true;
                    }
                    else
                        tempPropertyDescriptors.Add(propDescriptor);
                }

                if (customDescriptorsCreated)
                    _properties = new PropertyDescriptorCollection(tempPropertyDescriptors.ToArray(), true);
            }

            return _properties;
        }
開發者ID:Rhombulus,項目名稱:aftermath,代碼行數:31,代碼來源:DataControllerTypeDescriptor.cs

示例2: FilterProperties

        private PropertyDescriptorCollection FilterProperties(PropertyDescriptorCollection originalCollection)
        {
            // Create an enumerator containing only the properties that are not in the provided list of property names
            // and fill an array with those selected properties

            IEnumerable<PropertyDescriptor> selectedProperties = originalCollection.OfType<PropertyDescriptor>().Where(p => !_excludeBrowsableProperties.Contains(p.Name));
            PropertyDescriptor[] descriptors = selectedProperties.ToArray();

            // Return a PropertyDescriptorCollection containing only the filtered descriptors
            PropertyDescriptorCollection newCollection = new PropertyDescriptorCollection(descriptors);
            return newCollection;
        }
開發者ID:kuluva5476,項目名稱:CouchPotato,代碼行數:12,代碼來源:OSDChannelList.cs

示例3: InitializeColumns

 private void InitializeColumns(PropertyDescriptorCollection columnDescriptors) {
     _columns = columnDescriptors.OfType<PropertyDescriptor>().Select(p => new SimpleColumnProvider(this, p)).OfType<ColumnProvider>().ToList();
 }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:3,代碼來源:SimpleTableProvider.cs


注:本文中的System.ComponentModel.PropertyDescriptorCollection.OfType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。