Jon,

> In his excellent book Jeffrey Richter says the Microsoft guidelines
> recommend operators are accompanied by a friendly public instance method
> that calls the operator method internally. For example the suggested CLS
> compliant name for operator + is Add. Does anyone know...
>
> /1/ why the friendly method should be an instance method rather than a
> static method?

I imagine because it's somewhat "simpler" and more natural to use?

>
> /2/ why the C# compiler generates a static method called op_Addition for
> operator+ rather than the recommended instance method called Add?

Because that's the operator itself. IOW, Managed operators are nothing more
than static methods with a known name and marked with the specialname
metadata attribute in the signature.

--
Tomas Restrepo
[EMAIL PROTECTED]

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to