Convert code with using statements to fully-qualified names

676 views Asked by At

How do I convert a file originally written with using directives to be completely fully qualified names?

E.g. go from

using System;
using System.Collections.Generic;
using System.Net;
using System.IO;
using System.Text;
using System.Xml.XPath;

namespace ChatterBotAPI
{
    public interface ChatterBotSession
    {
        ChatterBotThought Think(ChatterBotThought thought);
        string Think(string text);
    }

    internal class PandorabotsSession : ChatterBotSession
    {
        private readonly IDictionary<string, string> vars;

        public PandorabotsSession(string botid)
        {
            vars = new Dictionary<string, string>();
            vars["botid"] = botid;
            vars["custid"] = Guid.NewGuid().ToString();
        }

        public ChatterBotThought Think(ChatterBotThought thought)
        {
            ...
}

to this

namespace ChatterBotAPI
{
    public interface ChatterBotSession
    {
        ChatterBotThought Think(ChatterBotThought thought);
        string Think(string text);
    }

    internal class PandorabotsSession : ChatterBotSession
    {
        private readonly System.Collections.Generic.IDictionary<string, string> vars;

        public PandorabotsSession(string botid)
        {
            vars = new System.Collections.Generic.Dictionary<string, string>();
            vars["botid"] = botid;
            vars["custid"] = System.Guid.NewGuid().ToString();
        }

        public ChatterBotThought Think(ChatterBotThought thought)
        {
            ...
}
1

There are 1 answers

4
M.kazem Akhgary On
  • Install Resharper Tool.

  • Go to Resharper tab => Options...

  • Go to Code Editing section => C# => Code Style

  • Tick Prefer fully qualified references. (and save changes)

  • Right click on your project and select CleanUp code. (Or press Ctrl E + Ctrl C)

  • select Full Clean up and you are good to go (if you don't want full clean up then you can make your own profile and only chose Coding style to be applied.)