How to find all similar elements in a list?

I’m trying to create a crafting system but I need to know how many of each item I have it my list (aka inventory). For some reason this code is not working:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Crafting : MonoBehaviour {
	private Inventory i;
	public GameObject Stick;
	private int sticksNum = 0;
	private int stones = 0;

	// Use this for initialization
	void Start () {
		i = gameObject.GetComponent<Inventory> ();
	}

	public void makeStoneAxe() {

		foreach (Stick in i.getItemsInList()) {
			sticksNum += 1;
		}
	}
	// Update is called once per frame
	void Update () {
		Debug.Log (sticksNum);

	}


}

foreach (Stick in i.getItemsInList()) {
sticksNum += 1;
}

the object doesn’t have an identifier.

 foreach (Stick s in i.getItemsInList()) {
         sticksNum += 1;
}

I don’t know what getItemsInList returns so i can’t help with that part.