How do I use GetComponent in one Line

Hi I am trying to find a way to use GetComponent without the use of an extra variable in one line. Here is what I have so far.

I’m assuming you’ve already attached a script to some game object.
Assuming you want to get, say a BoxCollider2D that is attached to the same game object, you could use:

BoxCollider2D collider = GetComponent();