BindingList<T>.FindCore(PropertyDescriptor, Object) 메서드

정의

파생 클래스에서 검색 기능이 구현되었으면 지정된 값을 가진 지정된 속성 설명자가 있는 항목의 인덱스를 검색하고, 그렇지 않으면 NotSupportedException을 발생시킵니다.

protected:
 virtual int FindCore(System::ComponentModel::PropertyDescriptor ^ prop, System::Object ^ key);
protected virtual int FindCore (System.ComponentModel.PropertyDescriptor prop, object key);
abstract member FindCore : System.ComponentModel.PropertyDescriptor * obj -> int
override this.FindCore : System.ComponentModel.PropertyDescriptor * obj -> int
Protected Overridable Function FindCore (prop As PropertyDescriptor, key As Object) As Integer

매개 변수

prop
PropertyDescriptor

검색할 PropertyDescriptor입니다.

key
Object

일치시킬 prop 값입니다.

반환

속성 설명자와 일치하고 지정된 값을 포함하는 항목의 인덱스(0부터 시작)입니다.

예외

FindCore(PropertyDescriptor, Object)가 파생 클래스에서 재정의되지 않은 경우

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 FindCore 멤버입니다.

    public class MyFontList : BindingList<Font>
    {

        protected override bool SupportsSearchingCore
        {
            get { return 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.ToLower() == ((string)key).ToLower())
                    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> 검색의 기본 구현을 제공하지 않으므로 FindCore 항상 기본적으로 을 NotSupportedException throw합니다. 검색을 사용하도록 설정하려면 에서 BindingList<T> 파생하고 다음 작업을 수행합니다.

적용 대상