CodeModelEventsClass::ElementAdded Event

 

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

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

Namespace:   EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

public:
event _dispCodeModelEvents_ElementAddedEventHandler^ ElementAdded {
	virtual void add(_dispCodeModelEvents_ElementAddedEventHandler^ value);
	virtual void remove(_dispCodeModelEvents_ElementAddedEventHandler^ value);
}

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.

System_CAPS_noteNote

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.

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
Return to top
Show: