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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:35:25+00:00 2026-05-16T02:35:25+00:00

Hey, I have this code here: ArrayList arrayList = new ArrayList(); arrayList.add(one); arrayList.add(two); arrayList.add(three);

  • 0

Hey, I have this code here:

ArrayList arrayList = new ArrayList();
arrayList.add("one");
arrayList.add("two");
arrayList.add("three");

List<DataRow> dataList = GetDataList(some params);

Now I want to check if arrayList contains ther elements from dataList. The string is at itemarray[0] in dataList. Is there a nice short code version to do that?

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-16T02:35:26+00:00Added an answer on May 16, 2026 at 2:35 am

    In .NET 3.5 to check if all the elements from one list are contained in another list:

    bool result = list.All(x => dataList.Contains(x));
    

    Or you can do it using a combination of Except and Any:

    bool result = !list.Except(dataList).Any();
    

    In your example you are using an ArrayList. You should change this to List<object> or List<string> to use these methods. Otherwise you can write arrayList.Cast<object>().

    bool result = arrayList.Cast<object>().All(x => dataList.Contains(x));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 488k
  • Answers 488k
  • 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 Actually there is nothing wrong with your jQuery code. You… May 16, 2026 at 8:45 am
  • Editorial Team
    Editorial Team added an answer To run SharePoint 2010 Foundation as an Internet Facing deployment,… May 16, 2026 at 8:45 am
  • Editorial Team
    Editorial Team added an answer As I thought the problem can be solved by extending… May 16, 2026 at 8:45 am

Trending Tags

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

Top Members

Related Questions

Hey I have this code right here: http://pastie.org/534470 And on line 109 I get
Hey, I have a code segment here: <div class=label><%= f.label :course %> <span>(Does this
Hey Guys, here is my code for this, the only help i get from
Hey! I was looking at this code at http://www.gnu.org/software/m68hc11/examples/primes_8c-source.html I noticed that in some
Hey I have been battling with this problem for a while now. Perhaps there
hey, this i have a loop that adds gathered strings and ints into an
UPDATE: I have determined that the SQLClient code times out on the first call,
I have some php code in a database like so $x = <?php some
Hey everyone, great community you got here. I'm an Electrical Engineer doing some programming
Hey guys, lately I have been asking quite a few questions about memory management

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.