Exportar (0) Imprimir
Expandir Tudo
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original

StateManagedCollection.SetDirtyObject Método

When overridden in a derived class, instructs an object contained by the collection to record its entire state to view state, rather than recording only change information.

Namespace:  System.Web.UI
Assembly:  System.Web (em System.Web. dll)

protected abstract void SetDirtyObject(
	Object o
)

Parâmetros

o
Tipo: System.Object

The IStateManager that should serialize itself completely.

The SetDirtyObject method is called internally by the SaveViewState(), Add(Object), and Insert(Int32, Object) methods.

The following code example demonstrates how a strongly typed StateManagedCollection class implements the abstract SetDirtyObject method.The CycleCollection uses a StateBag object to store its view-state information, and simply delegates the call to the SetDirty method of the StateBag object.This code example is part of a larger example provided for the StateManagedCollection class.








[AspNetHostingPermission(SecurityAction.Demand, 
    Level=AspNetHostingPermissionLevel.Minimal)]
   CycleCollection : StateManagedCollection {

       Type[] _typesOfCycles 
        =  Type[] { (Bicycle), (Tricycle) };

      object CreateKnownType( index) {
        (index) {
             0:
                  Bicycle();
             1:
                  Tricycle();                    
            :
                  ArgumentOutOfRangeException();
        }            
    }

      Type[] GetKnownTypes() {
         _typesOfCycles;
    }

       SetDirtyObject(object o) {
        ((Cycle)o).SetDirty();
    }

}


Contribuições da comunidade

ADICIONAR
Mostrar:
© 2014 Microsoft