2016-11-16 10 views
0

私はIntellisenseでダイナミッククラスを作成する方法を見つけようとしています。私はこの投稿の同じ指示に従おうとしましたIs it possible to provide intellisense for dynamic objects in visual studio?、おそらく私はそれを行うには成功しませんでした。 2つのインタフェースICompletionSourceICompletionSourceBuilderを実装することは不可能で、彼らは一瞬のために私のコードベローのVisual Studioバージョン2015.`C#でIntellisenseをDynamicクラスに実装する方法は?

で認識できないしている:

2つのインタフェースICompletionSourceとICompletionSourceBuilderを実装することは不可能
namespace IntellisenseTest 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      dynamic d = new DynamicDictionary(); 
      d.test = "test"; 
      Console.WriteLine(d.test); 
      Console.Read(); 
     } 

    } 


    internal class DynamicDictionary : DynamicObject 
    { 
     Dictionary<string, object> dictionary 
     = new Dictionary<string, object>(); 

     public override bool TryGetMember(
     GetMemberBinder binder, out object result) 
     { 
      string name = binder.Name.ToLower(); 

      return dictionary.TryGetValue(name, out result); 
     } 

     public override bool TrySetMember(
     SetMemberBinder binder, object value) 
     { 
      dictionary[binder.Name.ToLower()] = value; 
      return true; 
     } 

    } 
} 

答えて

0

Visual Studioバージョン2015では認識されません。 '

これらの2つのインターフェイスICompletionSourceとICompletionSourceBuilderは2つのインターフェイスhttps://msdn.microsoft.com/en-us/library/mt683786.aspx?f=255&MSPPError=-2147217396を使用する前に、Visual Studio SDKをインストールする必要があります。

参考用に使用ICompletionSourceのサンプルを示します。 https://msdn.microsoft.com/en-us/library/ee372314.aspx

+0

ご協力ありがとうございます、私はSDKをインストールすることを忘れてしまいました。しかし、それはまだ動作しません、私はsdkをインストールし、私のPCを再起動し、2つのインターフェイスはまだ認識されていません。私はあなたの2番目のリンク 'Microsoft.VisualStudio.Language.Intellisense; 'を使って見てきました。また、VisualStudioによっても認識されません。 – Trofis

+0

プロジェクトに次の参照を追加して、CopyLocalがfalse Microsoft.VisualStudio.Editorに設定されていることを確認してください Microsoft.VisualStudio.Language.Intellisense Microsoft.VisualStudio.OLE.Interop Microsoft.VisualStudio.Shell.14.0 Microsoft.VisualStudio.Shell.Immutable.10.0 Microsoft.VisualStudio.TextManager.Interop –

+0

ああ申し訳ございませんが、私は今、私は本当に今、この2つのインタフェースで、私の動的クラスにインテリセンスを追加する方法ない、それを逃しました。それをダイナミッククラスにすることは可能でしょうか? – Trofis

関連する問題