Handling multiple tags

My idea is to add multiple gameobjects with different tags and I would like to use List for it, more like using a List as a method. This is what I’ve had so far.

public void FindObjectsWithTags<GameObject>(string[] tags)
	{
		var compList = new List<GameObject>();
		for (int i = 0; i < tags.Length; i++)
		{
			var taggedObjects = GameObject.FindGameObjectsWithTag(tags*);*
  •  	compList.AddRange(taggedObjects);*
    
  •  }*
    
  • }*
    I’ve used List many times, but I haven’t do List as a method before, plus there’s an error on on “var taggedObject = …” lines, so I’m kinda lost right now. Could someone point me to the right direction? I really want to use this List method because it’s the most efficient way to handle multiple tags. Sorry for this idk, lame question maybe? Thanks.

change public void FindObjectsWithTags<GameObject>(string[] tags) to public void FindObjectsWithTags(string[] tags)should fix it.