Member cannot be accessed with an instance reference; qualify it with a type name instead

I was in the middle of programming a block puzzle, when the block entered a trigger it’s position was set to the triggers position and a door opened. So far everything worked, but I wanted to lock the block’s position to the trigger so I tried to freeze the Rigidbody constraints but I got an error that said:

“Member ‘RigidbodyConstraints2D.FreezePositionX’ cannot be accessed with an instance reference; qualify it with a type name instead”

Here’s the code:

 void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Box")
        {
            other.transform.position = transform.position;
            Door.SetActive(false);
            other.GetComponent<RigidbodyConstraints2D>().FreezePositionX = true;

        }
    }

other.GetComponent().constraints = RigidbodyConstraints2D.FreezePositionX;