IntelliSense
code completion
software development
programming tips
C#

How to hide public methods from IntelliSense

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

In C#, a method that is truly public is part of your public API, so the first question is whether it should be public at all. If the method must remain callable but you want it to appear less prominently in editor completion, the usual tool is EditorBrowsable. That hides the member from IntelliSense in many IDE scenarios, but it does not change accessibility or security.

Use EditorBrowsable for IntelliSense Hiding

The standard attribute is EditorBrowsable with the Never state.

csharp
1using System.ComponentModel;
2
3public class ApiHelper
4{
5    public void RecommendedMethod()
6    {
7    }
8
9    [EditorBrowsable(EditorBrowsableState.Never)]
10    public void LegacyMethod()
11    {
12    }
13}

This tells supporting editors that LegacyMethod should not normally appear in IntelliSense. The method is still public and still callable in compiled code.

Understand What This Does Not Do

EditorBrowsable is a tooling hint, not an access control feature. Reflection can still see the member, existing source code can still call it, and consumers can still type its name manually.

That is why this attribute is best used for compatibility APIs, advanced members, or legacy methods you do not want to advertise in normal completion lists. It is not a substitute for good API design.

Prefer Real Visibility Changes When Possible

If a method should not be part of the public contract, the cleaner answer is often to make it internal, private, or move it behind an explicit interface implementation.

csharp
1public interface IInternalWorkflow
2{
3    void ExecuteInternalStep();
4}
5
6public class Worker : IInternalWorkflow
7{
8    void IInternalWorkflow.ExecuteInternalStep()
9    {
10    }
11}

An explicit interface member does not show up as a normal instance method on Worker, which can be a better design than exposing a public method and then trying to hide it cosmetically.

Use Documentation to Explain Intent

If a public method exists only for framework integration, serialization, designer support, or backward compatibility, document that clearly. Hidden IntelliSense alone does not explain why the member exists.

That matters because advanced users may still discover the member through source, metadata, or manual typing. A short XML comment that says "for framework use only" is often more valuable than trying to make the API invisible.

Be Aware of IDE Differences

Most .NET tooling respects EditorBrowsable, but behavior can vary by editor, context, and whether the code is inside the same solution or assembly. You should treat the attribute as a strong hint, not as a guaranteed universal hiding mechanism.

This is another reason not to rely on it for correctness. If using the method would break callers, the method should not be public in the first place.

Versioning Is a Common Use Case

A practical use case is keeping an obsolete compatibility method callable for old code while steering new code toward a replacement.

csharp
1using System.ComponentModel;
2
3public class ReportService
4{
5    public void Generate()
6    {
7    }
8
9    [EditorBrowsable(EditorBrowsableState.Never)]
10    [Obsolete("Use Generate instead.")]
11    public void BuildReport()
12    {
13        Generate();
14    }
15}

This combines editor guidance with compiler guidance, which is usually much more effective than hiding alone.

Common Pitfalls

  • Trying to hide a method from IntelliSense when the real issue is that the method should not be public.
  • Assuming EditorBrowsable prevents access instead of only influencing tooling.
  • Relying on hidden completion as a security or correctness boundary.
  • Forgetting to document why a hidden public method still exists.
  • Ignoring alternatives such as internal or explicit interface implementation.

Summary

  • Use EditorBrowsable(EditorBrowsableState.Never) to hide a public member from IntelliSense in many cases.
  • The method remains public and callable.
  • Prefer real visibility changes when the member is not meant to be part of the public API.
  • Combine hiding with documentation or Obsolete when you are guiding users away from legacy members.
  • Treat IntelliSense hiding as a usability hint, not as enforcement.

Related reading
Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.