Hiding GetHashCode/Equals/ToString from fluent interface classes intellisense in Visual Studio for C#?

时光怂恿深爱的人放手 提交于 2019-12-03 02:30:13
Frederik Gheysels

According to thread, it is by design. The methods/properties decorated with EditorBrowsable(EditorBrowsableState.Never) are only hidden from intellisense if they're part of a class that is in another referenced assembly. The assembly should not be part of the same solution.

Ok, I found the solution, it was partly my fault, and partly incomplete documentation.

My fault was that I had not tagged all the methods in the correct class, but even when correcting that, the methods still showed up.

Turns out the note in the documentation, which reads:

In Visual C#, EditorBrowsableAttribute does not suppress members from a class in the same assembly.

Should actually be (emphasis mine):

In Visual C#, EditorBrowsableAttribute does not suppress members from a class in the same open solution.

I tagged the methods in the appropriate class, did a full rebuild, created a new project outside of the solution file, made file references to the compiled files from my IoC project, and lo and behold, the methods disappeared.

I'll leave the question up in case someone else has this problem.

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