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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:23:32+00:00 2026-05-24T03:23:32+00:00

I have an object with a string-typed parameter called ‘ baan_cat_fam_code ‘. The code

  • 0

I have an object with a string-typed parameter called ‘baan_cat_fam_code‘. The code below is my attempt to find all items in the query that have a baan_cat_fam_code that exist in a generic string list called catFamCd.

query = query.Where(r => r.baan_cat_family_code.Any(s => catFamCode.Contains(s)));

The problem is that this won’t compile – I get an error that states

"Argument type 'char' is not assignable to parameter type 'string'"

for some reason the predicate s is typed as char. So I append .ToString() to the argument in the .Contains method. However, when the code runs, I get the following exception thrown when the result of the query is bound to a listbox.

"The argument 'value' was the wrong type. Expected 'System.Char'. Actual 'System.String'."

This has got me scratching my head. Any assistance would be greatly appreciated.

Thanks!

  • 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-24T03:23:34+00:00Added an answer on May 24, 2026 at 3:23 am

    The problem you’re running into is that baan_cat_family_code is of type string which implements IEnumerable<char>. When you call Any it’s essentially saying

    • Is the predicate true for any char in this string

    What you really want to be asking though is

    • Is this string in the list catFamCode

    Try the following which does the latter

    query = query.Where(r => catFamCode.Contains(r.baan_cat_family_code));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey. I have an object that has a string property called BackgroundColor. This string
I have a object of type ICollection<string> . What is the best way to
I have a string object with multiple characters and even special characters I am
I'm an absolute beginner, you see. Say I have a string object on the
I have an object that can build itself from an XML string, and write
In Ruby, methods which change the object have a bang on the end: string.downcase!
Suppose I have a python object x and a string s , how do
If I have two variables: Object obj; String methodName = getName; Without knowing the
Lets say I have a Dictionary object: Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();
I have a string I need to feed to a com object that has

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.