Freigeben über


CodeModelEventsClass.ElementChanged Event

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

Raised when a CodeElement object has been changed.

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

Syntax

'Declaration
Public Overridable Event ElementChanged As _dispCodeModelEvents_ElementChangedEventHandler
public virtual event _dispCodeModelEvents_ElementChangedEventHandler ElementChanged
public:
virtual   event _dispCodeModelEvents_ElementChangedEventHandler^ ElementChanged {
    void add (_dispCodeModelEvents_ElementChangedEventHandler^ value);
    void remove (_dispCodeModelEvents_ElementChangedEventHandler^ value);
}
abstract ElementChanged : IEvent<_dispCodeModelEvents_ElementChangedEventHandler,
    EventArgs>
override ElementChanged : IEvent<_dispCodeModelEvents_ElementChangedEventHandler,
    EventArgs>
JScript does not support events.

Implements

_dispCodeModelEvents_Event.ElementChanged

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. For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

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

.NET Framework Security

See Also

Reference

CodeModelEventsClass Class

EnvDTE80 Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples

Discovering Code by Using the Code Model (Visual Basic)

Discovering Code by Using the Code Model (Visual C#)