Język

StaticSiteMapProvider.Clear Metoda

Definicja

Usuwa wszystkie elementy w kolekcjach węzłów podrzędnych i nadrzędnych węzłów mapy lokacji, które śledzi jako StaticSiteMapProvider część 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 udostępnionego dla klasy StaticSiteMapProvider.

   // 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 pochodzące z StaticSiteMapProvider klasy mogą zastąpić metodę w celu przeprowadzenia dodatkowego Clear czyszczenia, w zależności od stanu, który utrzymuje klasy pochodne.

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

Dotyczy

Zobacz też