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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:46:56+00:00 2026-06-03T06:46:56+00:00

I would like to concatenate a string using lambda to compare that concatenated value

  • 0

I would like to concatenate a string using lambda to compare that concatenated value against a certain condition.

Invoices = Invoices.Where(f => ((string)f.invoice_prefix + String.Format("{0:0000}", Convert.ToInt32(f.invoice_number))).ToLower().Equals(condition7));

But I get an error message :

The name ‘f’ does not exist in the current context

Tried several String.Format and String.Concat variants like

Invoices = Invoices.Where(f => (String.Format("{0}{1}",f.invoice_prefix,String.Format("{0:0000}", Convert.ToInt32(f.invoice_number)))).ToLower().Equals(condition7));

but no success… Can somebody help me with the syntax?

Thanks in advance!

  • 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-03T06:46:57+00:00Added an answer on June 3, 2026 at 6:46 am

    Linq to Entities doesn’t understand all of the .NET framework methods.

    In order to run this as a SQL statement on the database, you need to only use operators that can be converted to SQL. That means you need to re-write your predicate using primitive data types.

    So something like this:

    string prefixCondition = ...
    int invoiceNumberCondition = ...
    
    Invoices.Where( f =>
      f.invoice_prefix == prefixCondition
      &&
      f.invoice_number == invoiceNumberCondition 
    )
    

    I recommend using LinqPad to test with, as it shows you the generated SQL statement.

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

Sidebar

Related Questions

I have multiple FlowDocuments that I would like to concatenate together. The method below
I would like to concatenate strings. I tried using strcat : x = 5;
I have a string in PHP that I would like to split. This string
Would like to make anapplication in Java that will not automatically parse parameters used
I would like to know what guys are using to make diagram of your
I would like to put an int into a string . This is what
I would like to append two strings together so that I can rename a
What would be your preferred way to concatenate strings from a sequence such that
I would like to test the Flickr API using Matlab. There is no Flickr
I am trying to concatenate a few NSStrings but would like to exclude the

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.