Accessing the mesh collider of each gameobject in an array and setting false

Hi guys,
I have a script that toggles a group of mesh renderers on and off on keypress.
Each one of these gameobjects also has a child gameobject with a mesh collider component.
I need to access each one of these children gameobjects concurrently and toggle these on/off as well.
I’ve been trying the GetComponentInChildren declaration but it is a little beyond me.
I have been trying to generate a second array with the mesh collider components and then loop through this to disable, without success. Any hints would be appreciated.

using UnityEngine;
using System.Collections;

public class HideScript : MonoBehaviour {

    public bool femoralOn = true;

	
	// Update is called once per frame
	void Update () {
        //create an array of objects with the tag "A"
        GameObject[] femoralObjects = GameObject.FindGameObjectsWithTag("A");
        //the array of colliders on the children of the above tagged A objects
        GameObject[] femoralColsInChil;

        if (Input.GetKeyDown(KeyCode.F))
        {
            Debug.Log("F key was pressed");
            femoralOn = !femoralOn;
        }

        // the active state of the toggle
        if (femoralOn == true)
        {
            for (var f = 0; f < femoralObjects.Length; f++)
            {
                femoralObjects[f].GetComponent<MeshRenderer>().enabled = true;
                femoralColsInChil = femoralObjects[f].GetComponentInChildren<MeshCollider>();

                for(var fc = 0; fc < femoralColsinChil.Length; fc++)
                {
                    femoralColsInChil.collider.enabled = false;
                }

            }
        }

     //rest of code continues from here

You code works as well, save for one detail: You use GetComponentInChildren (note the singular) and try to put this into an array, which doesn’t make sense since you will only get one component in return.

Anyway, here is what I would suggest as the cleanest way of doing what you want:

 // the active state of the toggle
             if (femoralOn == true)
             {
                 for (var f = 0; f < femoralObjects.Length; f++)
                 {
                     MeshCollider[] meshColliders = femoralObjects[f].GetComponentsInChildren<MeshCollider>(true) as MeshCollider[];
                     foreach(MeshCollider meshCollider in meshColliders) {
                         if(meshCollider.gameObject == femoralObjects[f]) {
                              //the parent
                              meshCollider.enabled = true;
                         }
                         else {
                             //a children MC
                             meshCollider.enabled = false;
                         }
                         
                     }
                 }
             }

Note that " GameObject femoralColsInChil" is not used at all. I would recommend to not put variables in the main body of a script if they are assigned as part of a loop. Better temporarily create a new variable just outside the loop, like I did with the “meshColliders” array above.