FilteredBindingList and DefaultFilter

FilteredBindingList and DefaultFilter

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


amselem posted on Wednesday, August 08, 2007

The DefaultFilter class implementation is as follows

      result = CStr(item).Contains(CStr(filterValue))

But this causes odd behavior, for example if item is 120 integer and filtervalue is 0 integer then returns True because "120" contains "0".

I know that I can create my own FilterProvider but I think that the "default" filter behavior should use "equals" method like this:

   result = item.Equals(filterValue)

Jacobo

 

RockfordLhotka replied on Wednesday, August 08, 2007

For every person who wants exactly equality, there's at least one who wants "like". And the current implementation is case-sensitive, and that's often undesirable as well.

The point I'm trying to make is that the default filter is what it is, and it can only serve one need. All other needs must be served by custom filters.

Copyright (c) Marimer LLC