Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
struct Vector3
{
public float X, Y, Z;
public static bool operator true(Vector3 v)
{
return v.X != 0 && v.Y != 0 && v.Z != 0;
}
public static bool operator false(Vector3 v)
{
return v.X == 0 && v.Y == 0 && v.Z == 0;
}
public static bool operator !(Vector3 v)
{
return v.X == 0 && v.Y == 0 && v.Z == 0;
}
}
class Program
{
static void Main(string[] args)
{
var id = new Vector3 { X = 1, Y = 1, Z = 1 };
var zero = new Vector3();
if (id) Console.WriteLine("id is true");
if (!zero) Console.WriteLine("zero is false");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment