BindingList<T>.SupportsSearchingCore 属性   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个值,该值指示列表是否支持搜索。
protected:
 virtual property bool SupportsSearchingCore { bool get(); };protected virtual bool SupportsSearchingCore { get; }member this.SupportsSearchingCore : boolProtected Overridable ReadOnly Property SupportsSearchingCore As Boolean属性值
如果列表支持搜索,则为 true;否则为 false。 默认值为 false。
示例
下面的代码示例演示如何使用 SupportsSearchingCore 成员。
    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> 不提供搜索的基本实现,因此 SupportsSearchingCore 默认情况下始终返回 false 。 有关实现搜索的详细信息,请参阅 IBindingList.Find 方法。