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

The Archive Base Latest Questions

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

I am having two list<string> as follows listA is having the following values 10,20,30,40

  • 0

I am having two list<string> as follows

listA is having the following values 10,20,30,40 and

listB is having the following values 10,20,30

If listB contains listA elements i would like to enable particular controls if not i would like to disable the Controls

I tried of using two loops as follows

for(int ilist1=0;ilist1<listA.count;ilist1++)
{
  for(int ilist2=0;ilist2<listB.count;ilist2++)
  {
      if(listA[ilist1]==listB[ilist2])
      {
           //Enable particular control
      }
  }
}

But i know this is not an appropriate one to do so can any one tell me the best approach to achieve 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-25T20:51:36+00:00Added an answer on May 25, 2026 at 8:51 pm

    What you want to do is to hash the items in the first list into a set then verify for each item in the second is within the set. Unfortunately the HashSet<> is not available so the closest you can get is the Dictionary<,>.

    Do this:

    Dictionary<string, string> set = new Dictionary<string, string>();
    foreach (string item in listA)
    {
        set.Add(item, item);
    }
    
    foreach (string item in listB)
    {
        if (!set.ContainsKey(item))
        {
            //Enable particular control
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a dropdown list in my web page. And it contains two lists.
I'm having a set of row data as follows List<String> l_lstRowData = new List<string>
I'm having a List<String> l_lstTemp and which contains A1 A1_1 A1_2 1A B2_1 B1_2
I'm having a Dictionary like Dictionary<String, List<String>> MyDict = new Dictionary<string, List<string>> { {One,new
I have two list of different objects : List<Report> List<Newsletter> each having a 'created
Here i am having a unordered list displaying two columns code and name .I
I am having trouble displayin the values of list itmes in the proper order.
I have two tables Product having following structure: ProductID,ProductName, IsSaleTypeA, IsSaleTypeB, IsSaleTypeC 1, AAA,
Consider the following string: $MRK - Merck - ($AAPL, $MSFT, $F) having day $AA!
Here is my issue: I have two lists as follows: [(Float, Integer)] and [(String,

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.