Trying to convert Js to C#

hi folks, im trying to convert this Js:
var emptyslot : Transform;
var xtemp;
var ytemp;

    function OnMouseUp(){
    
    	if (Vector3.Distance(transform.position,emptyslot.position)==1)  
    	{
    		xtemp=transform.position.x;
    		ytemp=transform.position.y;
    		transform.position.x=emptyslot.position.x;
    		transform.position.y=emptyslot.position.y;
    		emptyslot.position.x=xtemp;
    		emptyslot.position.y=ytemp;
    	}
    	
    }

I came to this result:

using UnityEngine;
using System.Collections;

public class mov : MonoBehaviour {

	public Transform vazio;
	private float xtemp;
	private float ytemp;

	void  OnMouseUp (){

		if (Vector3.Distance(transform.position,vazio.position)==1f)  
		{
			xtemp = transform.position.x;
			ytemp = transform.position.y;
			transform.position = vazio.position;
			vazio.position.x = xtemp;
			vazio.position.y = ytemp;

		}

	}
}

BUT this don’t work. Can someone help me?

@ivmarel is correct, you are probably getting an error for trying to set the readonly values of position.x and position.y

`

using UnityEngine;
        using System.Collections;


public class mov : MonoBehaviour {
         
            public Transform vazio;
            private float xtemp;
            private float ytemp;
         
            void  OnMouseUp (){
         
               if (Vector3.Distance(transform.position,vazio.position)==1f)  
               {
                 xtemp = transform.position.x;
                 ytemp = transform.position.y;
                 transform.position = vazio.position;
                 vazio.position = new Vector3(xtemp, ytemp, 0);
         
               }
         
            }
        }

`

Atleast that is the only thing wrong with the script, but ofcoure there can be other issues that cause it, but that is hard to tell without the actual error message.