Change selected object position by 1

This is an editor extension I am working on. I am wanting to make it so that when you press a button on the editor it increases the x postion value by 1.

if(GUILayout.Button("X")) 
		{
			Selection.transforms[0].position.x += 1;
		}

Assets/Editor/ObjectBuilderEditor.cs(53,49): error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.position’. Consider storing the value in a temporary variable

You can’t do that in c#, you need to get a copy of the struct(vector3), modify it and pass it back as the position:

if(GUILayout.Button("X")) 
{
  Vector3 posCopy = Selection.transform[0].position;
  posCopy.x += 1;
  Selection.transforms[0].position = posCopy;
}