Is it possible to create a new operator in c#?

Aaron Palmer picture Aaron Palmer · Jun 24, 2009 · Viewed 24.1k times · Source

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 = (y < z) ? y : z;

To be equivalent to this:

var x = y <? z;

In other words, I would like to create my own <? operator.

Answer

AgileJon picture AgileJon · Jun 24, 2009

No, it is not possible. You would need to create a method instead