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 8488251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:28:49+00:00 2026-06-10T21:28:49+00:00

when working with the List class, i have noticed that the boolean i was

  • 0

when working with the List class, i have noticed that the boolean i was looking for was:

 if(lstInts.Exists(x)){...}

X is a Predicate of T the same as lstInts. I was confused as to why you just cant pass int the int in this case, and why X’s type isnt of type T.

Example i was testing:

List<int> listInt = new List<int>();
int akey = Convert.toInt32(myMatch.Value);
Predicate<int> pre = new Predicate<int>(akey);  //akey is not the correct constructor param.
if(listInt.Exists(pre)){
   listInt.add(akey);
}

Is there a reason for having the additional Step of Predicate, or…. if i am going about the logic incorrectly?

I also noticed that the predicate constructure does not take an item of type T. Sort of confused as to how this is suppose to work.

  • 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-06-10T21:28:50+00:00Added an answer on June 10, 2026 at 9:28 pm

    You could also use Contains() method

    List<int> listInt = new List<int>();
    int akey = Convert.toInt32(myMatch.Value);
    
    if(listInt.Contains(akey)){
      listInt.add(akey); 
    }
    

    Or alternately use Any()

    if(listInt.Any(I => I == akey)) { 
      // Do your logic 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that is using a generic list of a custom class.
I have been working on a recursively defined list class in Python and I'm
I have a recursive function working on a list, the function contains a loop
i have implemented a list view its working fine but when i click on
I am working on a script that will scroll through list elements by clicking
I have a application im working on that uses the Jabber Libraries to connect
In my Android project I have 3 classes: 1st a List class contains a
I have created a custom list view and created my own adapter class I
I have Generic list holding root objects means I have: public class Component {
I have a class that is already extending TabActivity so i can't extend ListActivity.

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.