Serialization

All Better ListView elements, element collections and some support structures can be both binary and XML serialized. These classes implement ISerializable and IXmlSerializable interfaces. They are also marked by SerializableAttribute.

Serializable element classes are:

Serializable element collections are:

Serializable support structures are:

Comparing Elements and Collection by Value

When you need to check whether two objects from Better ListView (namely elements or collections) are same, you can serialize them and compare the serialized data. More efficient way to do the same is to call EqualsContent method.

When using EqualsContent on element instances, this method checks whether the two elements have same text, font, color... rather than whether there are the same instance (as happens with Equals ro ReferenceEquals):

C#

// create some item
BetterListViewItem item1 = new BetterListViewItem("new iem");

// create second item as a clone of the first
BetterListViewItem item2 = (BetterListViewItem)item1.Clone();

// check whether item1 and item2 are different instances
item1.Equals(item2); // returns false

// check whether item1 and item2 have properties with the same values
item1.EqualsContent(item2); // returns true

Visual Basic

' create some item
Dim item1 As New BetterListViewItem("new iem")

' create second item as a clone of the first
Dim item2 As BetterListViewItem = DirectCast(item1.Clone(), BetterListViewItem)

' check whether item1 and item2 are different instances
item1.Equals(item2) ' returns false

' check whether item1 and item2 have properties with the same values
item1.EqualsContent(item2) ' returns true


When using EqualsContent on collection instances, this method check whether both collections contain the same instances of collection items. It does not compare collection items by content. To do this, you still need to iterate both collections and call EqualsContent on each collection element.