System.ComponentModel.PropertyDescriptor.GetChildProperties C# (CSharp) Méthode

GetChildProperties() public méthode

[To be supplied.]

public GetChildProperties ( ) : PropertyDescriptorCollection
Résultat PropertyDescriptorCollection
        public PropertyDescriptorCollection GetChildProperties()
        {
            return GetChildProperties(null, null);
        }

Same methods

PropertyDescriptor::GetChildProperties ( Attribute filter ) : PropertyDescriptorCollection
PropertyDescriptor::GetChildProperties ( object instance ) : PropertyDescriptorCollection
PropertyDescriptor::GetChildProperties ( object instance, Attribute filter ) : PropertyDescriptorCollection

Usage Example

 /// <summary>
 /// 
 /// </summary>
 /// <param name="parentPD"></param>
 /// <param name="list"></param>
 private void GetList(PropertyDescriptor parentPD,ref IList list)
 {
     PropertyDescriptorCollection childPDs = parentPD.GetChildProperties();
     // if childPDs count < 0 then return
     if(childPDs.Count<=0 )
     {
         return;
     }
     // if parentPD is immultable type then return
     Type parentType = parentPD.PropertyType;
     if(    parentType.Name.Equals("String")
         || parentType.Name.Equals("Int32")
         || parentType.Name.Equals("Int64")
         || parentType.Name.Equals("Float")
         || parentType.Name.Equals("Double")
         || parentType.Name.Equals("Boolean")
         || parentType.Name.Equals("DateTime"))
     {
         return;
     }
     foreach (PropertyDescriptor childPD in childPDs)
     {
         ComplexPropertyDescriptor subPropertyDescriptor = new ComplexPropertyDescriptor(parentPD, childPD, parentPD.Name + "." + childPD.Name);
         if (PropertyDescriptorNotInList((PropertyDescriptor)subPropertyDescriptor, list))
         {
             list.Add(subPropertyDescriptor);
         }
         PropertyDescriptorCollection subChildPDs = childPD.GetChildProperties();
         if(subChildPDs.Count> 0 )
         {
             GetList(childPD,ref list);
         }
         else
         {
             return;
         }
     }
 }
All Usage Examples Of System.ComponentModel.PropertyDescriptor::GetChildProperties