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 (繼承自 CodeDelegate)。
公用屬性 Access 設定並取得指定程式碼委派的存取屬性。
公用屬性 Attributes (繼承自 CodeDelegate)。
公用屬性 Attributes 取得委派所有屬性 (Attribute) 的集合。
公用屬性 BaseClass (繼承自 CodeDelegate)。
公用屬性 BaseClass 取得此 CodeDelegate2 物件據以衍生的類別。
公用屬性 Bases (繼承自 CodeDelegate)。
公用屬性 Bases 取得衍生出這個項目的類別集合。
公用屬性 Children (繼承自 CodeDelegate)。
公用屬性 Children 取得物件的集合,此集合包含在 CodeDelegate2 中。
公用屬性 Collection (繼承自 CodeDelegate)。
公用屬性 Collection 取得集合,此集合包含支援此屬性的 CodeDelegate2 物件。
公用屬性 Comment (繼承自 CodeDelegate)。
公用屬性 Comment 設定並取得與 CodeDelegate2 關聯的註解。
公用屬性 DerivedTypes (繼承自 CodeDelegate)。
公用屬性 DerivedTypes 取得從 CodeDelegate2 物件衍生的物件集合。目前還未在任何 Visual Studio 語言中進行實作。
公用屬性 DocComment (繼承自 CodeDelegate)。
公用屬性 DocComment 設定並取得 CodeDelegate 項目的文件註解。
公用屬性 DTE (繼承自 CodeDelegate)。
公用屬性 DTE 取得委派的父物件,即 CodeElement2 物件。
公用屬性 EndPoint (繼承自 CodeDelegate)。
公用屬性 EndPoint 取得位於委派尾端的文字位置。
公用屬性 Extender[String] (繼承自 CodeDelegate)。
公用屬性 Extender[String] 傳回要求的委派擴充項。尚未在 Visual C# 中進行實作。
公用屬性 ExtenderCATID (繼承自 CodeDelegate)。
公用屬性 ExtenderCATID 取得 CodeDelegate 物件的擴充項分類 ID (CATID)。尚未在 Visual C# 中進行實作。
公用屬性 ExtenderNames (繼承自 CodeDelegate)。
公用屬性 ExtenderNames 取得委派的可用擴充項清單。尚未在 Visual C# 中進行實作。
公用屬性 FullName (繼承自 CodeDelegate)。
公用屬性 FullName 取得委派檔案的完整路徑和名稱。
公用屬性 InfoLocation (繼承自 CodeDelegate)。
公用屬性 InfoLocation 取得委派的程式碼模型功能。
公用屬性 IsCodeType (繼承自 CodeDelegate)。
公用屬性 IsCodeType 取得是否可從這個委派取得 CodeType 物件。
公用屬性 IsDerivedFrom[String] (繼承自 CodeDelegate)。
公用屬性 IsDerivedFrom[String] 指出 CodeDelegate2 物件是否具有另一個物件做為基底。
公用屬性 IsGeneric 取得該委派是否為泛型。
公用屬性 Kind (繼承自 CodeDelegate)。
公用屬性 Kind 取得列舉型別,定義物件的型別。
公用屬性 Language (繼承自 CodeDelegate)。
公用屬性 Language 取得程式語言,用以撰寫委派。
公用屬性 Members (繼承自 CodeDelegate)。
公用屬性 Members 取得此 CodeDelegate2 元素所包含的項目集合。尚未在 Visual Basic 中進行實作。
公用屬性 Name (繼承自 CodeDelegate)。
公用屬性 Name 設定並取得 CodeDelegate2 物件的名稱。
公用屬性 Namespace (繼承自 CodeDelegate)。
公用屬性 Namespace 取得定義委派之父命名空間的物件。
公用屬性 Parameters (繼承自 CodeDelegate)。
公用屬性 Parameters 取得此 CodeDelegate2 的參數集合。
公用屬性 Parent (繼承自 CodeDelegate)。
公用屬性 Parent 取得 CodeDelegate2 物件的直接上層父物件。
公用屬性 ProjectItem (繼承自 CodeDelegate)。
公用屬性 ProjectItem 取得與這個 CodeDelegate2 物件關聯的 ProjectItem 物件。
公用屬性 Prototype[Int32] (繼承自 CodeDelegate)。
公用屬性 Prototype[Int32] 傳回具有此委派之 Stub 定義的字串。
公用屬性 StartPoint (繼承自 CodeDelegate)。
公用屬性 StartPoint 取得 TextPoint 物件,此物件定義委派的開頭。
公用屬性 Type (繼承自 CodeDelegate)。
公用屬性 Type 設定或取得物件,表示委派的程式設計型別。

回頁首

方法

  名稱 說明
公用方法 AddAttribute(String, String, Object) (繼承自 CodeDelegate)。
公用方法 AddAttribute(String, String, Object) 建立新的屬性程式碼建構,並在正確位置插入程式碼。
公用方法 AddBase(Object, Object) (繼承自 CodeDelegate)。
公用方法 AddBase(Object, Object) 將項目加入至繼承委派清單中。這個方法並未在 Visual Basic 中加以實作。
公用方法 AddParameter(String, Object, Object) (繼承自 CodeDelegate)。
公用方法 AddParameter(String, Object, Object) 建立委派的新參數,並在正確位置插入程式碼。
公用方法 GetEndPoint(vsCMPart) (繼承自 CodeDelegate)。
公用方法 GetEndPoint(vsCMPart) 傳回 TextPoint 物件,此物件會標示委派定義尾端。
公用方法 GetStartPoint(vsCMPart) (繼承自 CodeDelegate)。
公用方法 GetStartPoint(vsCMPart) 傳回 TextPoint 物件,此物件會定義委派定義開頭。
公用方法 RemoveBase(Object) (繼承自 CodeDelegate)。
公用方法 RemoveBase(Object) 從基底清單中移除委派。這個方法並未在 Visual Basic 中加以實作。
公用方法 RemoveMember(Object) (繼承自 CodeDelegate)。
公用方法 RemoveMember(Object) 從委派中移除成員。
公用方法 RemoveParameter(Object) (繼承自 CodeDelegate)。
公用方法 RemoveParameter(Object) 從委派的引數清單中移除參數。

回頁首

備註

這個物件衍生自 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 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例

使用程式碼模型探索程式碼 (Visual Basic)

使用程式碼模型探索程式碼 (Visual C#)