How to Access the Size component of a Collider from a Ray

Hello, I’m writing a collision detection script for my game in unity, and It would greatly help me to know the size of the object my ray hits.

This is what I would assume I could do.
I used “RayCastHit2D” to obtain the collider.

sizeX = hit.collider.size.x

But, there is apparently no component size for the collider. How can I get the size of the collider by only using the collider that the ray hit. I am quite confused, and cant wait to hear what the answer is. Thanks for the help!

This Question is answered.