Say you override operator*
for point3
and float
and then for float
and point3
you used the operator like this:
point3 * float
Can you know if the operator method is going to end up inlined?
Say you override operator*
for point3
and float
and then for float
and point3
you used the operator like this:
point3 * float
Can you know if the operator method is going to end up inlined?
As far as I know there is no way to know for certain as the JIT is responsible for inlining.
No, you can't tell for sure. In particular, because it's done at JIT time, it will depend on the version of the CLR - and I believe that the 64 bit CLR inlines differently to the 32 bit one as well. It will also depend on whether optimisations are enabled (e.g. whether you're debugging etc).
You can prevent inlining with MethodImplAttribute, but that doesn't help much...
There is no way to know if a particular method will be inlined or not. C# itself won't ever inline a method call. Only the JITer will do this. While there are certain operations that are likely to be inlined, the JITer makes no guarantees.