help with transforms please

transform.position.y = Up.transform.y;

i got up from

public Transform Up;

whats wrong with the first line of code?

oh and the error says

cannot modify a value type return value of unityengine.Trnasform.position consider storin the value ain a temporary variable

oh and im using c#

In C# you cannot modify the components of the transform vector (since they are final and thus can only be set by the constructor). To change a single component, use a temporary variable:

Vector3 temp = transform.position;
temp.y = Up.transform.position;
transform.position = temp;

(UnityScript does that too, under the hood)