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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:22:18+00:00 2026-05-30T15:22:18+00:00

Somebody explain to me this: I am trying to delete items from a list

  • 0

Somebody explain to me this:

I am trying to delete items from a list with matching ids contained in another list of strings.

Step 1 is as below:
Step1

I’m trying to delete Items from myListingSyncIDs where the ListingNumber matches ListingNumbers in lstListingsUpdatedIn24Hrs.

The item at [0] Equals a value from lstListingsUpdatedIn24Hrs, as shown in Step 2:
Step2

But as shown in Step3: The Remove fails:
Step3

Then After doing a RemoveAll(func) Step4: The Remove works

Step4

Somebody explain why the Remove(item) doesn’t work, Please …

Code:

        myListingSyncIDs.AddRange(myListingSync.Listings);

        #region Remove Listing References Fetched In The Last 24Hrs
        // Listing References Fetched In The Last 24Hrs
        // These will be excluded to optimise the running of the App.
        // Basically meaning that a complete sync of all listings 
        // will only be done once every 24hrs
        // So that if this is run every hr, it will not slow down the most recent additions
        List<String> lstListingsUpdatedIn24Hrs = DAL.PropertyPortalDAL.GetSahtWebserviceUpdatesIn24Hrs();
        List<P24SyncService.ListingSyncItem> myListingsUpdatedIn24Hrs =
            lstListingsUpdatedIn24Hrs.Select(p => new P24SyncService.ListingSyncItem()
            {
                ListingNumber = p,
                Status = P24SyncService.ListingState.AddedModified
            }).ToList();
        foreach (P24SyncService.ListingSyncItem myLSI in myListingsUpdatedIn24Hrs)
        {
            myListingSyncIDs.Remove(myLSI);
        }

        myListingSyncIDs.RemoveAll(p => lstListingsUpdatedIn24Hrs.Contains(p.ListingNumber));

        #endregion

ListingSyncItem is:

public partial class ListingSyncItem {

    private string listingNumberField;

    private ListingState statusField;

    /// <remarks/>
    public string ListingNumber {
        get {
            return this.listingNumberField;
        }
        set {
            this.listingNumberField = value;
        }
    }

    /// <remarks/>
    public ListingState Status {
        get {
            return this.statusField;
        }
        set {
            this.statusField = value;
        }
    }
}
  • 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-30T15:22:20+00:00Added an answer on May 30, 2026 at 3:22 pm

    At a guess, your ListingSyncItem type doesn’t override Equals, so List<T>.Remove doesn’t know that the item to remove is “equal” to the item in your list.

    Simply overriding Equals and GetHashCode appropriately (to check for the equality of ListNumber and Status, presumably, and build a hash code based on those) should fix the problem.

    For RemoveAll, you’re providing a predicate. That doesn’t use ListingSyncItem.Equals, which is why it’s working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to optimize this mysql query using EXPLAIN. Can somebody please help me
Can somebody explain me the flow of control in this tutorial : http://www.vogella.de/articles/AndroidSQLite/article.html#tutorialusecp I
Can somebody please explain to me the meaning of this line of code? val
I'm trying to convert this piece of code from PHP to C#. It's part
Can somebody explain to me the following (python 2.7) Two string numbers, from a
I'm beginner in Java, I'm trying to compile some small program, can somebody explain
Can somebody explain to me why the following works: template<class T> class MyTemplateClass {
Can somebody explain why the following code is not valid? Is it because the
Can somebody explain why the .Net framework team decided that a delegate without subscribers
Could somebody explain what is the meaning of DomHelper in google closure? What is

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.