Returning Multiple Variables From a Function

I’m new to unity and trying to use a Vector2 as an index position for a 2D array. I’ve done a lot of searching but haven’t found a solution yet. I tried something like this

int[,] intArray;
Vector2 pos = new Vector2(7, 6);
    
intArray[vectToInt(pos)] = 3;
    
int vectToInt(Vector2 i) {
	dualInt j;
	j.x = Mathf.RoundToInt (i.x);
	j.y = Mathf.RoundToInt (i.y);
	return j;
}
    
public struct dualInt {
	public int x;
	public int y;
}

to return two integers, but that didn’t work. How else could I do it in an efficient way, I was using

intArray[Mathf.RoundToInt (vector2.x), Mathf.RoundToInt (vector2.y)] = int;

but I want something simpler.

I created a struct similar to dualint in james2238’s more recent post, which I named int2. It has extension methods for 2D arrays to use the int2 as an index, as well as easy conversion from Vector2’s.