I know you can overload an existing operator. I want to know if it is possible to create a new operator. Here\'s my scenario.
I want this:
var x =
Not only can you not do that, but why would you want to?
I'm not sure what type your y and z are, but if they are of a numeric value type, you could probably use:
var x = Math.Min(y, z);
Though personally, I would still prefer:
var x = (y < z) ? y : z;
But I'm a bit of a ? : junky.
Good code is not just tight and efficient, but also readable. Even if you are the only one ever reading it, you'd come back to that operator one day and wonder what the heck that did.