C# Raycast Intersection

I would like to create script which makes a raycast intersect more than one gameobject like the image below. But I’m not sure where to start. Is there a way you could add multiple instances of a raycast with a for loop of the listed gameobjects or create a specific instance of a multi raycast for each gameobject?
1885429--121312--RaycastIntersect.png

Like this?

foreach(GameObject go in gos){
            if(Physics.Raycast(new Ray(go.transform.position, directionToNextObj, 100f))){
                blah();
            }
        }

I’m not the best with raycasting, but this would, assuming you had the direction to the next object, send a ray with the length of 100 from the current game object to the next in the specified list. If it wasn’t near enough or something got in the way, it would not do the blah(); but you could just add “else return;” and it would break the chain