c# - Is it possible to add an implicit operator in assembly A between types from assemblies G and M? -


let's there's graphics api g doesn't want depend on external math library , therefore defines vector parameters bare structs (like sharpdx raw types).

let there math library m.

a developer wants provide implicit operators in assembly a cast between full type math library m raw type graphics api g (another sample sharpdx, in case operators defined in m instead of a). note both of types have exact same memory representation.


afaik, there no means in c# language provide such operators. closest comes mind extension methods, user still needs call additional method conversion.

is possible or there samples of such operators being added through il rewrite? limited knowledge, i'd think possible appreciate additional feedback on matter.

thanks!

you rewriting il of 1 of 2 libraries, specifically, add implicit operator type (and in process add dependency on other library).

but think doing bad idea: means need use own version of library (i.e. can't use version nuget) , every time want upgrade it, you'll need run il rewriter again.

to me, sounds way work can write foo(bar) instead of foo(bar.tobaz()).


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -