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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:28:43+00:00 2026-05-15T11:28:43+00:00

I have a third party api, which has a class that returns an enumerator

  • 0

I have a third party api, which has a class that returns an enumerator for different items in the class.

I need to remove an item in that enumerator, so I cannot use “for each”. Only option I can think of is to get the count by iterating over the enum and then run a normal for loop to remove the items.

Anyone know of a way to avoid the two loops?

Thanks

[update] sorry for the confusion but Andrey below in comments is right.

Here is some pseudo code out of my head that won’t work and for which I am looking a solution which won’t involve two loops but I guess it’s not possible:

for each (myProperty in MyProperty)
{
if (checking some criteria here)
   MyProperty.Remove(myProperty)
}

MyProperty is the third party class that implements the enumerator and the remove method.

  • 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-15T11:28:44+00:00Added an answer on May 15, 2026 at 11:28 am

    Common pattern is to do something like this:

    List<Item> forDeletion = new List<Item>();
    
    foreach (Item i in somelist)
       if (condition for deletion) forDeletion.Add(i);
    
    foreach (Item i in forDeletion)
       somelist.Remove(i); //or how do you delete items 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple web service that has an API third party developers are
I have a third party SDK in C# which has class names like this:
Am using below third party API in my project development http://undesigned.org.za/2007/10/22/amazon-s3-php-class I have done
I have an ASP.NET 4.0 web application which uses a third-party API for external
I have third party API which seems to depends internally on Windows event dispatching.
I have an API DLL that several third party applications reference. Some of these
I'm working with a third party API that receives several parameters which must be
I have written a WCF REST API for third-party use. One of the things
I have third-party C code that writes data to a file. I want to
I have third party sites that link to some images on my site. The

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.