FilteredBindingList.Clear()

FilteredBindingList.Clear()

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


James_2JS posted on Monday, May 19, 2008

Hi,

Whilst debugging some of my code that wasn't working I found that FilteredBindingList.Clear() is implemented as follows:

/// <summary>
///
Clears the list.
///
</summary>
public void
Clear()
{
    _list.Clear();
}

This seems wrong to me, as it removes all entries from the list, and not just those in the filter.
Should it not perform some conditional action with if (_filtered) in a similar vein to FilteredBindingList.Count???? e.g.

/// <summary>
///
Clears the list.
///
</summary>
public void
Clear()
{
    if
(_filtered)
        for (int
index = Count - 1; index >= 0; index--)
            RemoveAt(index);
    else
        _list.Clear();
}

Thanks for any feedback!

James

RockfordLhotka replied on Monday, May 19, 2008

Interesting - yes, you are probably correct, and this is probably a bug. I'll add it to the wish list.

James_2JS replied on Monday, May 19, 2008

Cool! Thanks for the quick feedback!!

And also, a big thank you for all your efforts on this amazing framework!!

Cheers,

James

RockfordLhotka replied on Tuesday, May 27, 2008

I have put the change into the code in svn for 3.5.1. If you get a chance, can you give it a try and see if it works as you expect?

James_2JS replied on Thursday, June 05, 2008

Hi Rocky,

Sorry for the delay in getting back to you... all looks good to me!

Many thanks,

James

James_2JS replied on Monday, October 13, 2008

Hi Rocky,

Is there any chance you could also put this fix into the 3.0.x source please?

Many thanks,

James

RockfordLhotka replied on Thursday, October 23, 2008

I put the change into the 3.0 code in svn. If I do a 3.0.6 release at some point, this will be included.

Copyright (c) Marimer LLC