Click here to Skip to main content
12,829,346 members (40,001 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET LINQ
public class itemslist
            public string item1 { get; set; }
            public string item2 { get; set; }
            public string item3 { get; set; }

        private void button4_Click(object sender, EventArgs e)
         List<itemslist> obLstjitemslist=new List<itemslist>();
         itemslist objitemslist=new itemslist();

In the above example how to remove item2 in List?
Posted 12-Feb-13 19:28pm
Updated 12-Feb-13 20:01pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The question makes no sense, because "item2", or the value of the member item2 is not "added" to anything. The type itemlist is not a list, so it does not have such concept as "remove".

However, obLstjitemslist is a list, but the list of the elements of the type itemlist. When the code is executed, it has two items, but none of those items is "item2". So, again, nothing to remove.

Sandeepkumar potu 13-Feb-13 0:49am
i just want to remove objitemslist.item2 in List<itemslist>
I already answered. What cannot you get?
Sandeepkumar potu 13-Feb-13 1:14am
ok can i skip objitemslist.item2 while adding to List
You cannot skip, add or delete it. This is not an item.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170326.1 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100