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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:05:08+00:00 2026-05-18T04:05:08+00:00

I have the following ListView : and I’m creating a List<string> of the items

  • 0

I have the following ListView:

alt text

and I’m creating a List<string> of the items I want a list of rows to remove from that ListView:

List<String> lst =new List<String>{"A1","A2"};

I know that I can delete the rows using iterating through the index and deleting the item using RemoveAt() function, but is there any way to do this using LINQ?

  • 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-18T04:05:08+00:00Added an answer on May 18, 2026 at 4:05 am

    As far as A1/A2 are the keys, no LINQ is required:

    foeach(var a in new[] { "A1", "A2" })
        lw.Items.RemoveByKey(a);
    

    Why not?


    But if you want to use LINQ at any cost, write you own extension method:

    public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
    {
        foreach (var item in collection)
            action(item);
    }
    

    and use it this way:

    new[] { "A1", "A2" }.ForEach(a => lw.RemoveByKey(a));
    

    However keep in mind that this is a well-known but disputable approach.

    btw, List<T> already has such extension method, but my works for any IEnumerable<T>:

    new List<string> { "A1", "A2" }.ForEach(); // evokes List<T>.ForEach
    new[] { "A1", "A2" }.ForEach(); // evokes my
    new List<string> { "A1", "A2" }.AsEnumerable().ForEach(); // evokes my, I guess
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following goal: From a list in main activity that extends ListActivity, I
I have the following problem: I display items on a ListView and I want
I have the following ClickListener: itemList=(ListView)findViewById(android.R.id.list); itemList.setTextFilterEnabled(true); itemList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?>
I have the following ListView with a custom list item: I would like to
Helo. I have the following requirement: I have a list (ListView or Spinner depends
In my XML, I have the following <ListView android:id=@android:id/list android:layout_width=match_parent android:layout_height=fill_parent > </ListView> How
I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=> <td> <asp:LinkButton ID=UpdateButton
I have a ListView which contains custom rows. This custom row has following UI
I have following code that works fine when my ListView is already rendered (eg.
I'm new to android and I have following problem I have a ListView. 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.