title: PropertyGrid control + array of custom objects
body: <p>I have a PropertyGrid control to which I bind a container with an array of complex objects:</p>
  
  <pre><code>// Collection
  public class ParametersCollection
  {
      private ParameterObject [] _parameters = null;
  
      [Category("SubReportParams")]
      public ParameterObject [] Parameters 
      { 
          get { return _parameters; }
          set { _parameters = value; } 
      }
  
      public ParametersCollection()
      {
          // _parameters initialization here...
      }
  }
  
  // Complex object
  public class ParameterObject
  {
      private string _name = "";
      private string _value = "";
  
      [Category("Information"), DisplayName("Name")]
      public string Name 
      { 
         get { return _name; } 
         set { _name = value; } 
      }
  
      [Category("Information"), DisplayName("Value")]
      public string Value 
      { 
         get { return _value; } 
         set { _value = value; } 
      }
  }
  </code></pre>
  
  <p>Everything works fine, except two cases:</p>
  
  <ol>
  <li><p>In example, if array _parameters has only 2 items, default array size is 4 and items with indexes 2 and 3 are nulls. PropertyGrid displays these items as empty fields. How to force PropertyGrid to ignore these fields and simply not displaying it?</p></li>
  <li><p>_parameters variable is an array type, so _parameters items are displayed with their indexes from 0 to n. Is there a posibillity to display them with their names from property ParamObject.Name instead of their indexes from an array?</p></li>
  </ol>