How to make ray hitting only game objects with tag from list

Hello,
How to make a ray hitting only game objects with one of tags from list and how to create that list.

the simplest way is to use System.Linq;

if(myTagList.Contains(ihit.transform.tag)

Edit:

Getting an Array of all current Tags in UnityEditor use this:

var myTagList = UnityEditorInternal.InternalEditorUtility.tags;

Edit 2

using System.Linq;

string myTags[] = new string[]{"tag0","tag1","tag2"};

//raycast stuff 

if(myTags.Contains(hit.transform.tag)){
  switch(hit.transform.tag){
    case "tag0":
    // do stuff
    break;
    
    case "tag1":
    //do stuff
    break;
    
    case "tag2":
    //do stuff
    break;
    }
}

RaycastHit hit;

if(Physics.Raycast(startPos, direction, out hit){

if(hit.transform.tag == “TheTagName”){
//do stuff
}
}

That should do it