Suppose I created the following custom control:
public class BookshelfControl : Control
{
[Editor(typeof(ArrayEditor), typeof(UITypeEditor)),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Book[] Books { get; set; }
...
}
where Bookis a simple user class defined as:
public class Book : Component
{
public string Author { get; set; }
public string Genre { get; set; }
public string Title { get; set; }
}
With this, I can easily edit the collection Booksin the designer of Visual Studio.
However, if I create one instance BookshelfControl, then copy and paste into the constructor, the collection Bookswill not be copied, but instead the second control will refer to all the elements within the first contol collection (for example, bookshelfControl1.Book[0]equal bookshelfControl2.Book[0]).
, : Visual Studio Books ?