开发者

Why EditorBrowsable doesn't work?

开发者 https://www.devze.com 2023-01-30 18:24 出处:网络
I tried to hide inherited property in intellisense with EditorBrowsable (as said here Hiding user control properties from IntelliSense), when testing in client form though I can still see it why ?

I tried to hide inherited property in intellisense with EditorBrowsable (as said here Hiding user control properties from IntelliSense), when testing in client form though I can still see it why ?

[
Category("Main"),
Description开发者_C百科("Text"),
Obsolete("Don't use this"),
Browsable(false),
EditorBrowsable(EditorBrowsableState.Never)
]
public override String Text
{
    get { return null; }
}


Are you using ReSharper? It seems like ReSharper doesn't obey the EditorBrowsable attribute.
If I turn off ReSharper, I don't see my property. If I turn ReSharper on, it does show.

In ReSharper Options, go to Environment | IntelliSense | Completion Appearance and check "Filter members by [EditorBrowsable] attribute".

You still have to reference the assembly though, it doesn't work within a solution if you reference your usercontrol's project.


I repro. There is a Note in the MSDN article about this:

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

Oddly, I don't see it suppress it either when I put the UserControl in a different assembly in the same solution.
You may want to ping connect.microsoft.com about this, something isn't right.


As said in this answer's comments:

editorbrowsable only hides the method if you're just importing the dll, not if you're referencing another project in the solution i think


Have you tried this:

Visual Studio > Tools > Options > General > Hide Advance Members

Check the "Hide Advance Members", remember that, in Visual C#, EditorBrowsableAttribute does not suppress members from a class in the same assembly.

EditorBrowsableAttribute Class

0

精彩评论

暂无评论...
验证码 换一张
取 消