Share via


CodeModelEventsClass.ElementChanged Event

Definition

Raised when a CodeElement object has been changed.

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

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

Event Type

Implements

Examples

Dim WithEvents oCodeModelEvents As EnvDTE80.CodeModelEvents  
Public Sub OnCodeElementChanged(ByVal Element As EnvDTE.CodeElement, _  
  ByVal Change As EnvDTE80.vsCMChangeKind) Handles _  
  oCodeModelEvents.ElementChanged  
    MsgBox(Element.Name + "(Kind=" + Str(Element.Kind) + ") was _  
      changed (change=" + Str(Change) + ").")  
End Sub  

Remarks

Only one ElementChanged event occurs for any given change in the code. The "most local" object raises the event. For example, if a method’s access is changed, the ElementChanged event would be fired for that CodeMethod object only. There would not be an event raised for the containing CodeClass object.

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