Uhm, from your code it’s not really clear what you actually want to do. Both examples you’ve given won’t work and won’t even compile in C#.
Apart from the fact that you can’t assign a component(x, y or z) of the position property seperately due to the value type - property problem, you can’t assign a Vector3 value to a float variable.
If you just want to add a certain amount to along the Vector3.up axis you can do: