Filter list items and display them

Hi, I currently have a list of inventory items and would like some advice on the best way to filter them and display the item Sprites accordingly.

What I had in mind was clearing the list when a button is pressed (weapons for example) and then re-initializing the list with all items of type weapon. Is there a better way? Maybe using linq? Not used linq much before so if that is a better way can anyone advise how to do this please?

Linq is probably your best option yes.

Say you have a ScriptableObject, or any other class you want to build a list of

public class Item
{
	public enum TYPE {Weapon, Health, ExtraLife}

	public string name;
	public int value;
	public TYPE type;
}

You can use Linq to filter it, like

List<Item> items = new List<Item>();

public List<Item> Filter (Item.TYPE type)
{
	List<Item> displayList = (from item in items
		where item.type == type
		select item).ToList();
    return displayList;
}