By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,795 Members | 1,666 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,795 IT Pros & Developers. It's quick & easy.

filter ilist

P: n/a
I have a custom class QBank with a public property called QBankID. I
populate the ilist(to QBank). when the iList is populated, is there a way
i can filter on the QBankID property for where it = x.

I could filter this in the database call.. but i'd like to bring back a
larger dataset and only make one call to the database for the data
retrieval, then in code filter for the id i want, work on that.. and than
filter for another id and so on. i'm just trying to limit my db calls. I
could loop through the iList to get the value, just wondering if there is a
better way..

thanks
shannon
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"jvcoach23" <sh******@sucss.state.il.uswrote in message
news:1l*****************************@40tude.net...
>I have a custom class QBank with a public property called QBankID. I
populate the ilist(to QBank). when the iList is populated, is there a way
i can filter on the QBankID property for where it = x.

I could filter this in the database call.. but i'd like to bring back a
larger dataset and only make one call to the database for the data
retrieval, then in code filter for the id i want, work on that.. and than
filter for another id and so on. i'm just trying to limit my db calls. I
could loop through the iList to get the value, just wondering if there is
a
better way..
Not that I know of. As you mentioned, it's probably best to make a function
that will loop through the collection and return a new collection containing
only the items that match the search criteria. As you're only hitting the
database once and only making the one call to the function once per block it
probably won't slow things down much.

If you want it to look fancy you could extend Generic.List with a new method
which filters out the non-matching records?

Dim colMyList as QBankList = DatabaseFunctionToRetrieveItems()
colMyList.Filter(intQBankID)

Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.