How To Get “Find Usages” working with implicit operator methods?

╄→гoц情女王★ 提交于 2019-12-04 05:13:09

Maybe something like Resharper can do it, but I'm not sure. When I need to find usages, I do it the poor-man's way and remove the implicit operator, recompile and find the errors.

I suppose theoretically the compiler might then miss a case if it can use a different implicit operator (or switch to an "object" type overload of a method), but it tends to work for my usages. I'm sure there's a better solution, but it's worked for me so far.

EDIT: Just had a thought and tested it. Marking your implicit operator as [Obsolete] will actually result in a compiler warning wherever you use it! I suppose this will catch those corner cases where there are other valid overloads that you'd miss having removed the implicit operator altogether.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!