How to remove a specific object from a List<T>

Giani Noyez

So I've go a list which stores Feeds objects which are constructed with a link and a category. Now I want to delete a given Feeds object that has a specific Link and category.

The declaration of my list:

public void addFeed(String link, String cat) {
    linkAcategory.Add(new feed(link, cat));
}

The add function:

public void addFeed(String link, String cat) {
    linkAcategory.Add(new feed(link, cat));
}

The delete function which is not working but shows what I'm trying to do:

public void removeFeed(String link, String cat) {
    linkAcategory.Remove(new feed(link,cat));
}

I hope I get any valuable help here. Thanks in advance.

Saverio Terracciano

Assuming that the T object has the link and cat properties:

linkAcategory.RemoveAll(x=>x.link==link && x.cat==cat);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to remove specific row from list in angularjs

From Dev

How to remove duplicates from a List<List<T>> for value types T?

From Dev

How to remove a specific object from a List<T>

From Dev

How to remove items in a generic list from start until a specific condition

From Dev

Hibernate doesn't remove object from collection with children in specific case

From Dev

SetUniqueList, HashSet and Set don't remove duplicates from a List of an object

From Dev

How to remove a specific Object from an array of Objects, by object's property?

From Dev

How can I remove specific element from a list?

From Dev

Python - how to remove specific words from list?

From Dev

Get an object from multiple List<T> lists with a specific id

From Dev

How to remove duplicates from a list of object

From Dev

How to remove padding from a Object List Item?

From Dev

How to find (and remove) a nested object from a List

From Dev

In Python: How to remove an object from a list if it is only referenced in that list?

From Dev

How to remove a field from each object of a list of object?

From Dev

javascript - how to remove a specific value from a property in an object?

From Dev

How to remove object with specific name from ArrayList

From Dev

How to remove a specific object from an array

From Dev

How to remove specific strings from a list

From Dev

how to remove specific row from list in angularjs

From Dev

How to remove duplicates from a List<List<T>> for value types T?

From Dev

How to remove items in a generic list from start until a specific condition

From Dev

How to remove an object from a list that is not present in another list in R

From Dev

How to remove a specific package from dependency list of another package?

From Dev

How to remove duplicates from a list of object

From Dev

How to find (and remove) a nested object from a List

From Dev

How to remove an instance of object from a list in python?

From Dev

How to remove an object from a linked list in java

From Dev

destroying object doesn't remove delegate from invocation list

Related Related

  1. 1

    how to remove specific row from list in angularjs

  2. 2

    How to remove duplicates from a List<List<T>> for value types T?

  3. 3

    How to remove a specific object from a List<T>

  4. 4

    How to remove items in a generic list from start until a specific condition

  5. 5

    Hibernate doesn't remove object from collection with children in specific case

  6. 6

    SetUniqueList, HashSet and Set don't remove duplicates from a List of an object

  7. 7

    How to remove a specific Object from an array of Objects, by object's property?

  8. 8

    How can I remove specific element from a list?

  9. 9

    Python - how to remove specific words from list?

  10. 10

    Get an object from multiple List<T> lists with a specific id

  11. 11

    How to remove duplicates from a list of object

  12. 12

    How to remove padding from a Object List Item?

  13. 13

    How to find (and remove) a nested object from a List

  14. 14

    In Python: How to remove an object from a list if it is only referenced in that list?

  15. 15

    How to remove a field from each object of a list of object?

  16. 16

    javascript - how to remove a specific value from a property in an object?

  17. 17

    How to remove object with specific name from ArrayList

  18. 18

    How to remove a specific object from an array

  19. 19

    How to remove specific strings from a list

  20. 20

    how to remove specific row from list in angularjs

  21. 21

    How to remove duplicates from a List<List<T>> for value types T?

  22. 22

    How to remove items in a generic list from start until a specific condition

  23. 23

    How to remove an object from a list that is not present in another list in R

  24. 24

    How to remove a specific package from dependency list of another package?

  25. 25

    How to remove duplicates from a list of object

  26. 26

    How to find (and remove) a nested object from a List

  27. 27

    How to remove an instance of object from a list in python?

  28. 28

    How to remove an object from a linked list in java

  29. 29

    destroying object doesn't remove delegate from invocation list

HotTag

Archive