If my array property has null items, then I can't open CollectionEditor from PropertyGrid. I get error with text 'component'. How can I fix it?
public partial class Form1 : Form
{
public Test[] test { get; set; }
public Form1()
{
InitializeComponent();
test = new Test[5];
test[2] = new Test() { Name = "2" };
propertyGrid1.SelectedObject = this;
}
}
[TypeConverter(typeof(ExpandableObjectConverter))]
public class Test
{
public string Name { get; set; }
}
Maybe I should override some methods in my custom CollectionEditor, but i don't know which
It depends exactly how you want to work around this, but if you just need to exclude the null values, then you can override the default ArrayEditor class, something like this;