với các giá trị trong cơ sở dữ liệu, sau đó đối tượng không phải là bẩn. Rất hầu như không thể để luôn luôn biết cho dù giá trị của đối tượng phù hợp với những người trong cơ sở dữ liệu, do đó, việc thực hiện hiển thị ở đây hành vi trên thi hành "đoán tốt nhất." | CHAPTER 5 COMPLETING THE FRAMEWORK 253 Implementing a read-only sorted view of a collection is relatively straightforward but implementing a view that is bidirectionally updatable is quite complex. And that s exactly what SortedBindingList does. Acting As a View Let s look at the simple things first. The original collection as an ICollection has a set of properties such as Count and SyncRoot that are simply exposed by SortedBindingList. For instance here s the Count property Public Readonly Property Count As Integer _ Implements _ Of T .Count Get Return End Get End Property This technique is repeated for all the ICollection IList and lEnumerable properties. The notable exception to this is the default property which is quite a bit more complex and is discussed later. If the original collection implements IBindingList it has a broader set of properties. It might be editable and it might not. It might allow adding of new items or not. All these capabilities are exposed through its IBindingList interface and SortedBindingList merely assumes the same settings. For instance here s the AllowEdit property Public ReadOnly Property AllowEdit As Boolean _ Implements Get If mSupportsBinding Then Return Else Return False End If End Get End Property Recall from the constructor that if the original collection doesn t implement IBindingList then mSupportsBinding will be False. In that case AllowEdit returns False because in-place editing isn t valid unless the original collection implements IBindingList. This technique is repeated for all the IBindingList properties. Applying a Sort The IBindingList interface allows a sort to be applied to a collection either ascending or descending based on a single property. This is done through the ApplySort method. ApplySort Method SortedBindingList implements two overloads of ApplySort .