2016-12-21 7 views
0

usingディレクティブで書かれたファイルを完全修飾名に変換するにはどうすればよいですか?完全修飾名へのステートメントを使用したコードの変換

など。この

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) 
     { 
      ... 
} 
+0

実際の問題は何ですか?あなたは何を達成しようとしていますか? –

+0

@ un-lucky私は[誰か他の図書館](https://github.com/pierredavidbelanger/chatter-bot-api)を借りて、私のプロジェクトでそれを使いたいと思っています。私のプロジェクトでは、オンザフライでC#スクリプトを実行し、 'using'ディレクティブを適切に処理しないプログラムを使用しています。したがって、完全修飾名ですべてを指定する必要があります。 – theonlygusti

+0

@theonlygustiすべての 'using'行を削除し、各コンパイルエラーを調べ、正しい名前空間を指定します。 – Rob

答えて

2
  • Install Resharper Tool

    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) 
         { 
          ... 
    } 
    

    から行きます。

  • ゴーReSharperのにタブ=>オプション...コード編集部へ

  • ゴー=> C#=>コードスタイル

  • ティックは、完全修飾参照を好みます。 (そして変更を保存する)

  • プロジェクトを右クリックし、[クリーンアップコード]を選択します。

  • を選択してください。完全にクリーンアップしてください。完全にクリーンアップしたくない場合は、独自のプロファイルを作成し、適用するコーディングスタイルのみを選択できます。 )

+0

私は実際にはVisual Studioを使用していませんが、これは良い答えですので、これをupvoted。 – theonlygusti

+0

@theonlyGustiありがとうございます。私はビジュアルスタジオが重いIDEであることを知っているが、実際にそれに値する特別にresharperと混合したとき。それはいくつかの時間を試して:) –

関連する問題