deveton
deveton

Reputation: 341

How to hide public classes from being seen in C# Editor IntelliSense only?

Shortly,

The Browsable() and EditorBrowsable() works with members. not class itself.

So, I need to hide the accessibility of class that I can't make it internal. Just hide it from code.

An internal access modifier will make it only accessible in assembly the class created.

Why i need that?

I need some people can't access these classes. only I need writing it manually without showing in IntelliSense.

Updated

I mean all kind of types [ classes, structs, enums ].

When user or developer write for example Employee class it will not showing in intellisense. but its accessible and can be instantiated normally.

Upvotes: 1

Views: 1501

Answers (1)

Pavel Anikhouski
Pavel Anikhouski

Reputation: 23228

The answer depends, where the class is located. If it's the same solution, you can't hide it, by design, as it described in this article

It won't hide them from you because you are the developer (of the solution) not the user (of the assembly).

For the class in a separate assembly you can apply the [EditorBrowsable(EditorBrowsableState.Never)] attribute together with [Browsable(false)]

Upvotes: 4

Related Questions