How to find names of variables on Unity components?

I’m trying to make a Distance Joint in Unity 2D. I have it set up and it works properly in the game. However, when I go to set the ‘Connected Rigid Body’ field through code, I can’t figure out what the actual variable name is to get a reference to it.

This is the variable I want to access through code:

enter image description here

I want to be able to set that property like this:

distanceJoint2D.[nameofproperty] = other.transform.GetComponent<Rigidbody2D>(); 

Is there a way to figure out what the variable names associated with its components are?