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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:33:37+00:00 2026-05-22T14:33:37+00:00

I have a specific lambda what doesn’t seem to want to work properly although

  • 0

I have a specific lambda what doesn’t seem to want to work properly although the logic seems sound.

index = llCodeList.FindIndex(f => string.Compare(f.Threshold.ToString(), searchText, true ) >= 0);

f.Threshold is an integer value, it seems that the conversion doesn’t happen and it breaks my search function. Can anyone shed some light on this?

  • 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-22T14:33:38+00:00Added an answer on May 22, 2026 at 2:33 pm

    Why not ditch the string compare and explicitly check?

    index = llCodeList.FindIndex(
                f => f.Threshold.ToString()
                                .Contains(searchText));
    

    Are you sure that the search text is a subset of the threshold number?

    Also it may be that you’re not understanding how string.Compare works, it won’t check numerical value but string value. For the above if searchText is 4 and the threshold is -40 would match your predicate. My example more explicitly demonstrates the behavior of string.Compare(...,...,...) >= 0

    If you’re trying to find results based on having a greater than or equal to match on threshold and searchText you could do this

    int search = 0;
    int32.TryParse(searchText, out search);
    index = llCodeList.FindIndex(f => f.Threshold >= search);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a specific changeset that I want to rollback my Development branch to,
I have some specific id like 1,2,5,11,64589 in solr (int type) I want to
I'm parsing a string that doesn't have a delimiter but does have specific indexes
I have a std::vector and I want to check a specific attribute of each
I have an object array and I want to convert it to a specific
I'm building an web application that I want users to have specific permissions to
I have a specific case in mind, but the question applies in general too.
I have a specific requirement that all children of a particular JComponent have double
I have a specific question, that could use a general answer... When building Multi-Tier
I have a specific DB2 query, and I would like to execute this query

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.