BindingList<T>.SupportsSearchingCore Özellik

Tanım

Listenin aramayı destekleyip desteklemediğini belirten bir değer alır.

protected:
 virtual property bool SupportsSearchingCore { bool get(); };
protected virtual bool SupportsSearchingCore { get; }
member this.SupportsSearchingCore : bool
Protected Overridable ReadOnly Property SupportsSearchingCore As Boolean

Özellik Değeri

true liste aramayı destekliyorsa; aksi takdirde , false. Varsayılan değer: false.

Örnekler

Aşağıdaki kod örneğinde üyenin nasıl kullanılacağı gösterilmektedir SupportsSearchingCore .

public class MyFontList : BindingList<Font>
{
    protected override bool SupportsSearchingCore => true;
    protected override int FindCore(PropertyDescriptor prop, object key)
    {
        // Ignore the prop value and search by family name.
        for (int i = 0; i < Count; ++i)
        {
            if (Items[i].FontFamily.Name.Equals((string)key, StringComparison.CurrentCultureIgnoreCase))
            {
                return i;
            }
        }
        return -1;
    }
}
Public Class MyFontList
    Inherits BindingList(Of Font)

    Protected Overrides ReadOnly Property SupportsSearchingCore() As Boolean
        Get
            Return True
        End Get
    End Property
    
    Protected Overrides Function FindCore(ByVal prop As PropertyDescriptor, _
        ByVal key As Object) As Integer
        ' Ignore the prop value and search by family name.
        Dim i As Integer
        While i < Count
            If Items(i).FontFamily.Name.ToLower() = CStr(key).ToLower() Then
                Return i
            End If
            i += 1
        End While

        Return -1
    End Function
End Class

Açıklamalar

BindingList<T> sınıfı, aramanın temel bir uygulamasını sağlamaz, bu nedenle SupportsSearchingCore her zaman varsayılan olarak döndürürfalse. Arama uygulama hakkında daha fazla bilgi için yöntemine IBindingList.Find bakın.

Şunlara uygulanır