Share via


CodeDelegate2 インターフェイス

ソース コード内のデリゲートを表します。

名前空間:  EnvDTE80
アセンブリ:  EnvDTE80 (EnvDTE80.dll 内)

構文

'宣言
<GuidAttribute("3B1B24EF-DD8E-4C98-8799-4EFAC80080E9")> _
Public Interface CodeDelegate2 _
    Inherits CodeDelegate
[GuidAttribute("3B1B24EF-DD8E-4C98-8799-4EFAC80080E9")]
public interface CodeDelegate2 : CodeDelegate
[GuidAttribute(L"3B1B24EF-DD8E-4C98-8799-4EFAC80080E9")]
public interface class CodeDelegate2 : CodeDelegate
[<GuidAttribute("3B1B24EF-DD8E-4C98-8799-4EFAC80080E9")>]
type CodeDelegate2 =  
    interface 
        interface CodeDelegate 
    end
public interface CodeDelegate2 extends CodeDelegate

CodeDelegate2 型で公開されるメンバーは以下のとおりです。

プロパティ

  名前 説明
パブリック プロパティ Access 指定したコードのデリゲートのアクセス属性を設定または取得します。
パブリック プロパティ Attributes デリゲートのすべての属性のコレクションを取得します。
パブリック プロパティ BaseClass この CodeDelegate2 オブジェクトの派生元のクラスを取得します。
パブリック プロパティ Bases この項目の派生元であるクラスのコレクションを取得します。
パブリック プロパティ Children この CodeDelegate2 に含まれているオブジェクトのコレクションを取得します。
パブリック プロパティ Collection このプロパティをサポートしている CodeDelegate2 オブジェクトを含んでいるコレクションを取得します。
パブリック プロパティ Comment CodeDelegate2 に関連付けられたコメントを設定および取得します。
パブリック プロパティ DerivedTypes CodeDelegate2 オブジェクトから派生したオブジェクトのコレクションを取得します。現在は、どの Visual Studio 言語にも実装されていません。
パブリック プロパティ DocComment CodeDelegate 要素のドキュメント コメントを設定または取得します。
パブリック プロパティ DTE デリゲートの親オブジェクト (CodeElement2 オブジェクト) を取得します。
パブリック プロパティ EndPoint デリゲートの終了位置であるテキスト ポイントを取得します。
パブリック プロパティ Extender 要求された Extender をデリゲートに返します。Visual C# には実装されていません。
パブリック プロパティ ExtenderCATID CodeDelegate オブジェクトの Extender カテゴリ ID (CATID) を取得します。Visual C# には実装されていません。
パブリック プロパティ ExtenderNames デリゲートで使用できる Extender の一覧を取得します。Visual C# には実装されていません。
パブリック プロパティ FullName デリゲートのファイルの完全パスと名前を取得します。
パブリック プロパティ InfoLocation デリゲートのコード モデルの機能を取得します。
パブリック プロパティ IsCodeType このデリゲートから CodeType オブジェクトを取得できるかどうかを取得します。
パブリック プロパティ IsDerivedFrom CodeDelegate2 オブジェクトが他のオブジェクトをベースにしているかどうかを示します。
パブリック プロパティ IsGeneric デリゲートがジェネリックかどうかを取得します。
パブリック プロパティ Kind オブジェクトの型を定義する列挙値を取得します。
パブリック プロパティ Language デリゲートの作成に使用されたプログラミング言語を取得します。
パブリック プロパティ Members この CodeDelegate2 要素に含まれる項目のコレクションを取得します。Visual Basic では実装されていません。
パブリック プロパティ Name CodeDelegate2 オブジェクトの名前を設定および取得します。
パブリック プロパティ Namespace デリゲートの親名前空間を定義するオブジェクトを取得します。
パブリック プロパティ Parameters この CodeDelegate2 のパラメーターのコレクションを取得します。
パブリック プロパティ Parent CodeDelegate2 オブジェクトの直接の親オブジェクトを取得します。
パブリック プロパティ ProjectItem CodeDelegate2 オブジェクトに関連付けられている ProjectItem オブジェクトを取得します。
パブリック プロパティ Prototype このデリゲートのスタブの定義を保持する文字列を返します。
パブリック プロパティ StartPoint デリゲートの先頭を定義する TextPoint オブジェクトを取得します。
パブリック プロパティ Type デリゲートのプログラムの種類を表すオブジェクトを設定または取得します。

このページのトップへ

メソッド

  名前 説明
パブリック メソッド AddAttribute 新しい属性コード コンストラクターを作成して、正しい位置にコードを挿入します。
パブリック メソッド AddBase 継承したデリゲートの一覧に項目を追加します。このメソッドは、Visual Basic には実装されていません。
パブリック メソッド AddParameter デリゲートの新しいパラメーターを作成し、適切な場所にコードを挿入します。
パブリック メソッド GetEndPoint デリゲート定義の末尾を示す TextPoint オブジェクトを返します。
パブリック メソッド GetStartPoint デリゲート定義の先頭を定義する TextPoint オブジェクトを返します。
パブリック メソッド RemoveBase ベースの一覧からデリゲートを削除します。このメソッドは、Visual Basic には実装されていません。
パブリック メソッド RemoveMember デリゲートからメンバーを削除します。
パブリック メソッド RemoveParameter デリゲートの引数リストからパラメーターを削除します。

このページのトップへ

解説

このオブジェクトは CodeDelegate から派生します。

注意

特定の種類の編集を行った後に、クラス、構造体、関数、属性、デリゲートなどのコード モデル要素の値を決定できないことがあります。つまり、これらの要素の値は、信頼できる値ではなく、常に同じ値になるとは限りません。詳細については、「コード モデルを使用したコードの調査 (Visual Basic)」で、コード モデル要素値を変更する方法についての説明を参照してください。

[VisualBasic]

Sub codeDelegateExample(ByVal dte As DTE2)

    ' Before running this example, open a code document from a project
    ' and place the insertion point inside a variable definition.
    Try
        ' Retrieve the CodeVariable at the insertion point.
        Dim sel As TextSelection = _
            CType(dte.ActiveDocument.Selection, TextSelection)
        Dim del As CodeDelegate2 = _
            CType(sel.ActivePoint.CodeElement( _
            vsCMElement.vsCMElementVariable), CodeDelegate2)

        ' Display the base class name of the delegate.
        MsgBox("Delegate's base class name: " & del.BaseClass.Name)

    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub

public void codeDelegateExample(DTE2 dte)

[C#]

{
   // Before running this example, open a code document from a
   // project and place the insertion point inside a delegate 
   // declaration.
   try
   {
      TextSelection objTextSel;
      CodeDelegate objCodeDel;
      CodeElement objCodeElem;

      objTextSel = (TextSelection)dte.ActiveDocument.Selection;
      objCodeDel = 
      (CodeDelegate)objTextSel.ActivePoint.
      get_CodeElement(vsCMElement.vsCMElementDelegate);

      // Display the fullname of the CodeDelegate object.
      MessageBox.Show(objCodeDel.FullName);

      // Prove that the parent object of a CodeClass is a CodeElement.
      objCodeElem = (CodeElement)objCodeDel.Parent;
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}

参照

関連項目

EnvDTE80 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する

コード モデルを使用したコードの調査 (Visual Basic)

コード モデルを使用したコードの調査 (Visual C#)