StaticSiteMapProvider.Clear Metoda

Definicja

Usuwa wszystkie elementy w kolekcjach węzłów podrzędnych i nadrzędnych węzłów mapy lokacji, które śledzą StaticSiteMapProvider w ramach jego stanu.

protected:
 virtual void Clear();
protected virtual void Clear ();
abstract member Clear : unit -> unit
override this.Clear : unit -> unit
Protected Overridable Sub Clear ()

Przykłady

W poniższym przykładzie kodu pokazano, jak zastąpić metodę Clear w celu wykonania dodatkowego czyszczenia stanu obsługiwanego przez klasę.

Ten przykład kodu jest częścią większego przykładu podanego StaticSiteMapProvider dla klasy.

   // Clean up any collections or other state that an instance of this may hold.
   virtual void Clear() override
   {
      System::Threading::Monitor::Enter( this );
      try
      {
         rootNode = nullptr;
         StaticSiteMapProvider::Clear();
      }
      finally
      {
         System::Threading::Monitor::Exit( this );
      }

   }


public:
// Clean up any collections or other state that an instance of this may hold.
protected override void Clear() {
    lock (this) {
        rootNode = null;
        base.Clear();
    }
}
' SiteMapProvider and StaticSiteMapProvider methods that this derived class must override.
'
' Clean up any collections or other state that an instance of this may hold.
Protected Overrides Sub Clear()
    SyncLock Me
        aRootNode = Nothing
        MyBase.Clear()
    End SyncLock
End Sub

Uwagi

Klasy, które pochodzą z StaticSiteMapProvider klasy, mogą zastąpić metodę Clear w celu wykonania dodatkowego czyszczenia, w zależności od stanu, który utrzymuje klasy pochodne.

Metoda Clear nie resetuje stanu zainicjowanego Initialize podczas metody — resetuje tylko stan zainicjowany podczas BuildSiteMap metody.

Dotyczy

Zobacz też