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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:05:27+00:00 2026-05-10T17:05:27+00:00

I got one big question. I got a linq query to put it simply

  • 0

I got one big question.

I got a linq query to put it simply looks like this:

from xx in table where xx.uid.ToString().Contains(string[]) select xx 

The values of the string[] array would be numbers like (1,45,20,10,etc…)

the Default for .Contains is .Contains(string).

I need it to do this instead: .Contains(string[])…

EDIT : One user suggested writing an extension class for string[]. I would like to learn how, but any one willing to point me in the right direction?

EDIT : The uid would also be a number. That’s why it is converted to a string.

Help anyone?

  • 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. 2026-05-10T17:05:28+00:00Added an answer on May 10, 2026 at 5:05 pm

    spoulson has it nearly right, but you need to create a List<string> from string[] first. Actually a List<int> would be better if uid is also int. List<T> supports Contains(). Doing uid.ToString().Contains(string[]) would imply that the uid as a string contains all of the values of the array as a substring??? Even if you did write the extension method the sense of it would be wrong.

    [EDIT]

    Unless you changed it around and wrote it for string[] as Mitch Wheat demonstrates, then you’d just be able to skip the conversion step.

    [ENDEDIT]

    Here is what you want, if you don’t do the extension method (unless you already have the collection of potential uids as ints — then just use List<int>() instead). This uses the chained method syntax, which I think is cleaner, and does the conversion to int to ensure that the query can be used with more providers.

    var uids = arrayofuids.Select(id => int.Parse(id)).ToList();  var selected = table.Where(t => uids.Contains(t.uid)); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 97k
  • Answers 97k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, provided you are free of the necessity of editing… May 11, 2026 at 7:28 pm
  • Editorial Team
    Editorial Team added an answer Are you familiar with delegates in general? I have a… May 11, 2026 at 7:28 pm
  • Editorial Team
    Editorial Team added an answer Two options I can think of right away: It would… May 11, 2026 at 7:28 pm

Related Questions

I got a Function that returns a Collection<string> , and that calls itself recursively
I recently got a new laptop. Unfortunately, it came with Vista. It's been one
I've got a lot of small DLLs which I would like to make into
Is there any way to have something like svn externals for files stored in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.