GoDigram for .NET Framework and .NET Core
Northwoods.Go Namespace / GoObject Class / AddObserver Method
In This Topic
    AddObserver Method
    In This Topic
    Register an object as an observer of changes to this object.
    Syntax
    public virtual void AddObserver( 
       GoObject obj
    )

    Parameters

    obj
    Remarks

    Adding an observer object means that that observer's OnObservedChanged method will be called whenever this object is changed. If the obj is already an observer for this object, this call does nothing. CopyObject will not copy the list of observers for this object; the caller of CopyObject is responsible for doing so, just as with adding the copied object to a layer and/or group to update the Layer and Parent properties.

    Use of the observer mechanism is less efficient in both space and time than overriding the Changed method of the observed object's class. However it can be useful when it is inconvenient to implement such an override.

    See Also