Skip to content

Instantly share code, notes, and snippets.

@JamesKim2998
Created November 16, 2018 09:18
Show Gist options
  • Save JamesKim2998/f88c05299e9c7dfc36e2cf35ad1bbf43 to your computer and use it in GitHub Desktop.
Save JamesKim2998/f88c05299e9c7dfc36e2cf35ad1bbf43 to your computer and use it in GitHub Desktop.
public struct CustomVector2
{
public int X;
public int Y;
public CustomVector2(int x, int y)
{
X = x;
Y = y;
}
public static implicit operator CustomVector2((int, int) valueTuple)
{
return new CustomVector2(valueTuple.Item1, valueTuple.Item2);
}
}
public void Foo(CustomVector2 v)
{
// Do something.
}
public void Bar(params CustomVector2[] v)
{
// Do something.
}
public void Main()
{
Foo((0, 0));
Bar((0, 0), (0, 1), (1, 1), (2, 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment