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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:32:27+00:00 2026-06-06T13:32:27+00:00

I am using silverlight 4. I have a scenario where i need to compare

  • 0

I am using silverlight 4. I have a scenario where i need to compare two lists based on value.

  List<Option> lstoption1 = new List<Option>();
  Option opt = new Option();
  opt.OptionText = "Text1"; 
  lstoption1.add(opt)

  Option opt2 = new Option();
  opt2.OptionText = "Text2"; 
  lstoption1.add(opt2)


  Option opt3 = new Option();
  opt3.OptionText = "Text3"; 
  lstoption1.add(opt3)



  List<Option> lstoption2 = new List<Option>();
  Option opt = new Option();
  opt.OptionText = "Text1"; 
  lstoption2.add(opt)

  Option opt2 = new Option();
  opt2.OptionText = "Text4"; 
  lstoption2.add(opt2) 

  Option opt3 = new Option();
  opt3.OptionText = "Text3";
  opt3.OptionChecked = false; 

  lstoptions2.add(opt3)

I need to compare theese two lists based on OptionText

  1) var sameentities= which entities exisits in both lists.

    ie : it should return entities that has OptionText as 
           **Text1 & Text3**

  2) var existinlst1= which entities  exists only in lstoptions1.

     ie : it should return entity that has OptionText as
           **Text2** 

  3) var notexistinlist1=which entities not exists only in lstoptions1.

      ie : it should return entity that has OptionText as
           **Text4**

I am using so many for loops for this but i want to do it in a simple way using linq.

is there any easy way to find them using LINQ in silverlight.

Thanks for any help.

  • 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-06T13:32:28+00:00Added an answer on June 6, 2026 at 1:32 pm

    Assuming equality is set up appropriately:

    1) var sameentities= which entities exisits in both lists.

    var same = list1.Intersect(list2);
    

    2) var existinlst1= which entities exists only in lstoptions1.

    var list1Only = list1.Except(list2);
    

    3) var notexistinlist1=which entities not exists only in lstoptions1.

    var list2Only = list2.Except(list1);
    

    (I think – your description isn’t very clear.)

    You can pass a custom equality comparer into all of these methods to compare just by option text if you need to. Note that if you only need the option text from the results, you can project it first:

    var text1 = list1.Select(x => x.OptionText);
    var text2 = list2.Select(x => x.OptionText);
    // Now use the same methods as before, but with text1 and text2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The scenario: I have a PRISM application developed in Silverlight (4), and I'm using
Using Silverlight 4. I have two visual states for my control. I want to
I have a scenario and I really need your help. I have a Silverlight
I have recently been programming Web based applications using Silverlight & Ria Services. I
I have a silverlight based application consisting of charts using silverlight toolkit and connected
I have a set of webservices that I connect to using Silverlight Client. I
I'm using the Silverlight 3 datagrid and have a number of custom styles applied
I have a Silverlight application that is using a DataGrid. Inside of that DataGrid
I have a Silverlight 3 Application and for security I'm using Active Directory. For
We have custom headers in the Silverlight DataGrid using the ContentTemplate. We've got a

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.