How to Hide Public Methods from Intellisense

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

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)]

Hide some inherited methods from intellisense

As the comments reveal: No, there is no way to hide inherited events from Intellisense.

It is probably a bad decision too. If there would be a way, what if you forgot to unhide it when you implement it? Nobody would see that method but it would be there and if you type it, it would work. That would be a little bit odd.

how to hide method overloads from intellisense and main class code file when project is part of VS2013 solution?

Extension methods will be hidden from Intellisense if they are in a separate namespace which is defined among the using namespaces. If you need an extension method you can always add using some.namespace.with.extensions and it will be available again. This approach should be used wisely and extension methods should be used where they are appropriate. ReSharper doesn't use this rule and shows all possible extension methods from referenced libraries.

If a class implements many interfaces and there is no need to show all implemented methods, you can use the explicit implementation, for example:

public class SomeClass : SomeInterface
{
void SomeInterface.SomeInterfaceMethod()
{
// ... some code ...
}
}

When you check all methods of the class, SomeInterfaceMethod will not be shown unless the class is cast to the SomeInterface type.

Hide property from IntelliSense

You didn't mark the question as ef related, but from the comment on the property in the source code -

// Notice:Not allowed in Source code but is used by EFCore (EFCore limitation workaround).

if i get it right, you're using it only for queries / insert / update, and if this is the case you can hide the member using shadow properties or backing fields without public properties

How to hide properties and methods with an underscore in VSCode Intellisense?

This is currently not supported by VSCode's built-in JavaScript language features.

For TypeScript code, you can use the private modifier, but for JavaScript, there is no story for marking a property as private. I've opened an issue against the TypeScript project to track observing the the @private jsdoc annotation as a starting point: https://github.com/Microsoft/TypeScript/issues/14009

If you would like a more generic solution that marks all properties starting with _ as private, please fill out a feature request: https://github.com/Microsoft/vscode/issues/new

How to properly hide methods and properties from intellisense

It appears Visual Studio 2008 and 2010 now ignore the 'hidden' attribute, making otherwise hidden interfaces browseable.
It appears the interop assembly must be modified by adorning the following over classes, methods and properties that are intended to exist but not be browseable:

[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]

Source: http://www.summsoft.com/blogs/garyvsta/archive/2009/02/06/preserving-hidden-elements-in-a-com-interop-assembly.aspx

Hiding interface methods in Intellisense in Visual Studio

You can use EditorBrowsableAttribute on your methods.

EditorBrowsableAttribute Specifies that a property or method is viewable in an editor.
EditorBrowsableAttribute is a hint to a designer indicating whether a property or method is to be displayed. You can use this type in a visual designer or text editor to determine what is visible to the user. For example, the IntelliSense engine in Visual Studio uses this attribute to determine whether to show a property or method.

Something like

 

   [EditorBrowsable(EditorBrowsableState.Never)]
  public void GetId()
   {
}


Related Topics



Leave a reply



Submit