Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 179027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:20:04+00:00 2026-05-11T14:20:04+00:00

I have a list of objects that I want to filter by an integer

  • 0

I have a list of objects that I want to filter by an integer parameter

List<testObject> objectList = new List<testObject>();  // populate objectList with testObjects  objectList.FindAll(GroupLevel0);  private static bool GroupLevel0(testObject item) { return item._groupLevel == 0; }  private class testObject {      public string _FieldSQL = null;      public int _groupLevel; } 

What I’m looking to do is to make GroupLevel0 take in an integer as a parameter instead of hardcoding to 0. I’m working in .NET 2.0 so lambda expressions are a no-go. Is it even possible to pass a parameter into a predicate?

Thank you,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:20:04+00:00Added an answer on May 11, 2026 at 2:20 pm

    If you’re stuck with C# 2.0, use an anonymous method – just a slightly clunkier lambda expression (ignoring expression trees):

    List<testObject> objectList = new List<testObject>(); int desiredGroupLevel = 10;  objectList.FindAll(delegate (testObject item) {     return item._groupLevel == desiredGroupLevel; }); 

    Or you could still use a method call to start with:

    List<testObject> objectList = new List<testObject>(); int desiredGroupLevel = 10;  objectList.FindAll(CheckGroupLevel(desiredGroupLevel));  ...  public Predicate<testItem> CheckGroupLevel(int level) {     return delegate (testItem item)     {         return item._groupLevel == level;     }; } 

    If you’re using Visual Studio 2008 but targeting .NET 2.0, however, you can still use a lambda expression. It’s just a compiler trick which requires no framework support (again, ignoring expression trees).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSArray that I want to filter out certain objects using an
I have a list of objects that have two int properties. The list is
I have a List of objects that I would like to convert to a
I have a List of String objects that are pipe delimited. something like this:
I have a list/collection of objects that may or may not have the same
I have a list of pointers that reference time objects that need a turn
I have a list of IDs for objects that I need to grab, then
I have a listview that is loaded with a list of objects that contain
Im using a BaseAdapter and passing to it a List of objects that have
I have a list of objects, that are pre-sorted based on some complex criteria

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.