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

  • Home
  • SEARCH
  • 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 4075130
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:15:31+00:00 2026-05-20T17:15:31+00:00

I am calling a filtering method that accepts parameter Predicate T void MethodName(Predicate<T> param)

  • 0

I am calling a filtering method that accepts parameter Predicate T

void MethodName(Predicate<T> param)
{
}

x.MethodName(x => x.SomeProperty == 10); // or
x.MethodName(delegate(MyClass x) {return x.SomeProperty == 10;});

The problem is that I need to be able to filter on several different values, and the number of values is unknow. Example with 3 values ouwld be

x.MethodName(x => x.SomeProperty == 10 || x => x.SomeProperty == 20); // or
x.MethodName(delegate(MyClass x) {return x.SomeProperty == 10 || x.SomeProperty == 20;});

Can I make it work with uknown number of possible values? This would be greate, but its not possilbe 🙂

x.MethodName(x => x.SomeProperty == {10, 20});
  • 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. Editorial Team
    Editorial Team
    2026-05-20T17:15:31+00:00Added an answer on May 20, 2026 at 5:15 pm
    x.MethodName(x => new []{10, 20}.Contains(x.SomeProperty));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Calling Validate() on an XmlDocument requires passing in a ValidationEventHandler delegate. That event function
I have a major problem. We have a asp.net application that has this report
Calling instance method cancel on an NSURLConnection most often don't cancel the connection at
I want to write a Python program that makes PNG files. My big problem
Calling IEnumSTATURL::Next within my application returns E_UNEXPECTED(0x8000FFFF) instead of S_OK . Sadly, that particular
calling ListView's setSelection() seems to have a problem. a lot of people ask about
I am calling a giant stored proc via linq to sql that brings back
When calling JsonConvert.SerializeObject I am passing in an object that implements an interface. It
I'm calling an IronPython script and passing it a .NET object that contains a
I am calling a webservice that requires client certificate authentication. If I specify a

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.