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

Filtering a Custom Collection of business Objects - C#

P: n/a
I have a base collection class that I use to derive all my collections
from. It derives from CollectionBase. I have added custom Sorting and
now would like to add Filtering.

I have spent a decent amount of time looking thru code and really have
not found anything that suits my needs. I simply want to pass in a
filter expression use that that expression against the protected List
(exposed by CollectionBase) object and return an array list containing
only the objects that meet that filter expression.

Is this possible? OR Shall I just do forEach and check the props of
the objects I have stored in the Collection?

Any help would be great.

Erik
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Erik

I have created a set of classes for this, it's very easy using reflection.
Just give me a few hours to prepare you a document with the code and an
explanation of how to use it.

You use reflection, and you pass the property/method name you will filter
by and it does not require any modification in the classes being filtered .

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Erik" <Ri************@yahoo.com> wrote in message
news:16**************************@posting.google.c om...
I have a base collection class that I use to derive all my collections
from. It derives from CollectionBase. I have added custom Sorting and
now would like to add Filtering.

I have spent a decent amount of time looking thru code and really have
not found anything that suits my needs. I simply want to pass in a
filter expression use that that expression against the protected List
(exposed by CollectionBase) object and return an array list containing
only the objects that meet that filter expression.

Is this possible? OR Shall I just do forEach and check the props of
the objects I have stored in the Collection?

Any help would be great.

Erik

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.