Telerik® JustCode™ by Progress

The Fix Namespace Mismatch quick fix is available once Telerik® JustCode™ has detected a namespace that doesn't match the defined default namespace for that project. Telerik® JustCode™ underlines the namespace or the class (can be configured in the options) and suggests you to automatically rename it so that it matches the default namespace.

Note

Language Support

Supported: C#, VB.NET

Not relevant: ASP.NET, XAML, JavaScript, HTML

Suppose we have the following code:

Fix Namespace Mismatch Code

Lets set the default namespace for the project in Project -> Properties -> Application:

Fix Namespace Mismatch Default Namespace

In the solution explorer we have put the class in a folder as follows:

Fix Namespace Mismatch Explorer

JustCode will match the folders and subnamespaces and add a warning if they don't match.

To fix the namespace mismatch on the namespace identifier:

  1. Position the caret over the namespace identifier.
  2. Press Alt+Enter. From the pop-up menu, select Fix Namespace

    Fix Namespace Mismatch On Namespace
  3. The result is:

    Fix Namespace Mismatch Result

To fix the namespace mismatch on the class identifier:

  1. Position the caret over the class identifier.
  2. Press Alt+Enter. From the pop-up menu, select Move Type To Namespace 'SomeNamespace.SubNamespace'.

    Fix Namespace Mismatch On Class
  3. The result is:

    Fix Namespace Mismatch Result

See Also