Generic arrays?

Hi,

Simply for convenience, I am trying to create a static method that returns the closest transform in a passed array. Is it possible to read components off of a generic array?

public static Transform FindClosestInArray <T>(T[] array, Vector2 origin)
    {
        Transform nearest = null;
        float minDist = Mathf.Infinity;

        //loop through all to find nearest
        for(int i=0; i<array.Length;i++)
        {
            float dist = Vector2.Distance(array*.transform.position, origin);*

if(dist < minDist)
{
nearest = array*.transform;*
minDist = dist;
}
}

return nearest;
}
edit: Thanks everyone for the assistance!

Your array Elements T inherit from MonoBehaviour? If yes then you could write :
public static Transform FindClosestInArray (T array, Vector2 origin) where T : MonoBehaviour
that means you can pass any class which inherits from MonoBehaviour and then you can access the .transform since its a property of MonoBehaviour