BindingList<T>.SupportsSearchingCore 속성

정의

목록에서 검색을 지원하는지 여부를 나타내는 값을 가져옵니다.

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

속성 값

true목록에서 검색을 지원하는 경우 그렇지 않으면 . false 기본값은 false입니다.

예제

다음 코드 예제에서는 멤버를 사용하는 방법을 보여 줍니다 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

설명

클래스는 BindingList<T> 검색의 기본 구현을 제공하지 않으므로 SupportsSearchingCore 항상 기본적으로 반환 false 됩니다. 검색을 구현하는 방법에 대한 자세한 내용은 메서드를 참조하세요 IBindingList.Find .

적용 대상