How to detect 1 gameobject in an Array

I am scrambling my brains out and I can’t think of what I need. So basically I need a piece of code that will allow me to detect 1 gameobject that is active in an array of in activegameobjects other then that 1 gameobject and then be able to use the GetComponent<> command to pull info out of that game object’s script that is attached to it.

Can some one help me out here?

The following method will return the first active gameobject in the array if you pass the array of Gameobject to it.

@Nova_Tech

GameObject GetActiveObj(GameObject[] arrayOfObj)
    {
        for (int i = 0; i < arrayOfObj.Length; i++)
        {
            if (arrayOfObj*.activeSelf)*

{
return arrayOfObj*;*
}
}
return null;
}