Share via


CodeDelegate2 Interface

Definition

Represents a delegate in source code.

public interface class CodeDelegate2 : EnvDTE::CodeDelegate
public interface class CodeDelegate2 : EnvDTE::CodeDelegate
__interface CodeDelegate2 : EnvDTE::CodeDelegate
[System.Runtime.InteropServices.Guid("3B1B24EF-DD8E-4C98-8799-4EFAC80080E9")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface CodeDelegate2 : EnvDTE.CodeDelegate
[<System.Runtime.InteropServices.Guid("3B1B24EF-DD8E-4C98-8799-4EFAC80080E9")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type CodeDelegate2 = interface
    interface CodeDelegate
Public Interface CodeDelegate2
Implements CodeDelegate
Attributes
Implements

Examples

[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);  
   }  
}  

Remarks

This object derives from CodeDelegate.

Note

The values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same. For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

Properties

Access

Sets and gets the access attributes for the specified code delegate.

Attributes

Gets a collection of all of the attributes for the delegate.

BaseClass

Gets the class from which this CodeDelegate2 object is derived.

Bases

Gets a collection of classes from which this item is derived.

Children

Gets a collection of objects contained within this CodeDelegate2.

Collection

Gets the collection containing the CodeDelegate2 object supporting this property.

Comment

Sets and gets the comment associated with the CodeDelegate2.

DerivedTypes

Gets a collection of objects derived from the CodeDelegate2 object. Currently not implemented in any of the Visual Studio languages.

DocComment

Sets and gets the documentation comments for CodeDelegate element.

DTE

Gets the parent object of the delegate, namely a CodeElement2 object.

EndPoint

Gets the text point that is the location of the end of the delegate.

Extender[String]

Returns the requested Extender for the delegate. Not implemented in Visual C#.

ExtenderCATID

Gets the Extender category ID (CATID) for the CodeDelegate object. Not implemented in Visual C#.

ExtenderNames

Gets a list of available Extenders for the delegate. Not implemented in Visual C#.

FullName

Gets the full path and name of the delegate's file.

InfoLocation

Gets the capabilities of the code model for the delegate.

IsCodeType

Gets whether or not a CodeType object can be obtained from this delegate.

IsDerivedFrom[String]

Indicates whether or not a CodeDelegate2 object has another object as a base.

IsGeneric

Gets whether or not the delegate is a generic.

Kind

Gets an enumeration that defines the type of object.

Language

Gets the programming language used to author the delegate.

Members

Gets the collection of items this CodeDelegate2 element contains. Not implemented in Visual Basic.

Name

Sets and gets the name of the CodeDelegate2 object.

Namespace

Gets an object defining the parent namespace of the delegate.

Parameters

Gets a collection of parameters for this CodeDelegate2.

Parent

Gets the immediate parent object of a CodeDelegate2 object.

ProjectItem

Gets the ProjectItem object associated with the CodeDelegate2 object.

Prototype[Int32]

Returns a string holding the stub definition of this delegate.

StartPoint

Gets a TextPoint object that defines the beginning of the delegate.

Type

Sets or gets an object representing the programmatic type of the delegate.

Methods

AddAttribute(String, String, Object)

Creates a new attribute code construct and inserts the code in the correct location.

AddBase(Object, Object)

Adds an item to the list of inherited delegates. This method is not implemented in Visual Basic.

AddParameter(String, Object, Object)

Creates a new parameter for the delegate and inserts the code in the correct location.

GetEndPoint(vsCMPart)

Returns a TextPoint object that marks the end of the delegate definition.

GetStartPoint(vsCMPart)

Returns a TextPoint object that defines the beginning of the delegate definition.

RemoveBase(Object)

Removes the delegate from the list of bases. This method is not implemented in Visual Basic.

RemoveMember(Object)

Removes a member from the delegate.

RemoveParameter(Object)

Removes a parameter from the delegate's argument list.

Applies to