Default Find implementation for BusinessListBase?

Default Find implementation for BusinessListBase?

Old forum URL: forums.lhotka.net/forums/t/1635.aspx


Brian Criswell posted on Monday, October 30, 2006

Would it make sense to add a default Find implementation to BusinessListBase by overriding FindCore?

        protected override int FindCore(System.ComponentModel.PropertyDescriptor prop, object key)
        {
            for (int i = 0; i < this.Count; i++)
            {
                if (prop.GetValue(this[ i ]).Equals(key))
                {
                    return i;
                }
            }

            return -1;
        }

Then the constructor could have a this.AllowFind = true in it.

Copyright (c) Marimer LLC