CodeModelEventsClass.ElementAdded Event

Definition

Raised when a CodeElement object has been created. The new object is passed to the event handler.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
 virtual event EnvDTE80::_dispCodeModelEvents_ElementAddedEventHandler ^ ElementAdded;
public:
 virtual event EnvDTE80::_dispCodeModelEvents_ElementAddedEventHandler ^ ElementAdded;
public virtual event EnvDTE80._dispCodeModelEvents_ElementAddedEventHandler ElementAdded;
member this.ElementAdded : EnvDTE80._dispCodeModelEvents_ElementAddedEventHandler 
Public Overridable Custom Event ElementAdded As _dispCodeModelEvents_ElementAddedEventHandler Implements ElementAdded

Event Type

Implements

Examples

Dim WithEvents oCodeModelEvents As EnvDTE80.CodeModelEvents  
Public Sub OnCodeElementAdded(ByVal NewElement As EnvDTE.CodeElement) _  
  Handles oCodeModelEvents.ElementAdded  
    MsgBox(NewElement.Name + "(Kind=" + Str(NewElement.Kind) + ") was _  
      added.")  
End Sub  

Remarks

Although the object containing the new element is changed by the addition, no events are raised by the parent object. For example, if a parameter is added to a function, the ElementAdded event is raised for the new CodeParameter object. No events are raised for the CodeFunction object that contains it.

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.

Applies to