List.contains doesn't work and add duplicates

I am trying to avoid having to add duplicates in a list but for some reason the code doesn’t work. What am I doing wrong? here is the code:

 CharacterController characterController = GameObject.Find("Player").GetComponent<CharacterController>();
        Vector3 pointOfOrigin = transform.position + characterController.center;
        RaycastHit[] hit = Physics.SphereCastAll(pointOfOrigin, characterController.height / 2, transform.forward, 0.5f);

        List<int> enemiesHit = new List<int>();
        
        for (int i = 0; i < hit.Length; i++)
        {
            if (hit_.transform.gameObject.tag == "Enemy" & !enemiesHit.Contains(hit*.transform.gameObject.GetInstanceID()))*_

{
enemiesHit.Add(hit*.transform.gameObject.GetInstanceID());*
hit*.transform.gameObject.GetComponent().TakeDamage(damage);*
}
}

for (int x = 0; x < enemiesHit.Count; x++)
{
Debug.Log(enemiesHit[x]);
}

Nevermind, it seems to work, it’s just debug.log if placed within the loop won’t display anything for some reason.