Inline casting throwing errors when accessing variable

I’m trying to access a transform component on a game object but its a property of RectTransform so I need to cast it. When I do an inline cast the compiler throws a fit.

plateBar.(RectTransform)transform.anchorMax = new Vector2(1, 1);
      plateBar.(RectTransform)transform.anchorMin = new Vector2(1, 1);
      plateBar.(RectTransform)transform.rect = new Rect(50, 50, 300, 100);

Is this correct syntax for casting? I’m hesitant to use GetComponent for performance reasons.

if you want to access the component often, simply store the variable in Awake() or Start() (as RectTransform, from GetComponent or assignment via the inspector or whatever means is appropriate).
Then, use that variable to make your adjustments.

The attempts you were making to cast were all wrong there, but I think for now if you follow the first part of what I wrote, it won’t matter (as you won’t need it).