Unable to overloaded unary operator = in c#. it is giving error.
public static Result operator =(Int32 iv)
{
return new Result(){iv=iv};
}
Unable to overloaded unary operator = in c#. it is giving error.
public static Result operator =(Int32 iv)
{
return new Result(){iv=iv};
}
You cannot overload the = operator in C#.
From 7.2.2 Operator overloading:
In particular, it is not possible to overload member access, method invocation, or the
=,&&,||,?:,checked,unchecked,new,typeof,as, andisoperators.