私はクラスを持っています:
public class Filter
{
public Filter (string name, string value)
{
Name = name;
Value = value;
}
public string Name {get; private set;}
public string Value {get; set;}
}
コレクションクラス:
public class FilterCollection : Collection<Filter>
{
// code elided
}
私のコンポーネントクラス:
public class MyComponent : Component
{
// ...
[Editor(typeof(FilterEditor), typeof(UITypeEditor))]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public FilterCollection Filters { get; set; }
// ...
}
問題は、コレクションがデザイナーによって正しくシリアル化されていないことです。
私は何かが欠けていると確信していますが、何がわかりません。
追加情報
designer.cs ファイルに含めたいのは、次のようなものです。
myComponent.Filters.Add (new Filter ("some name", "some value"));
myComponent.Filters.Add (new Filter ("other name", "other value"));
これは実現可能ですか?