Skip to content

Reset

Resets the current counter value to zero..

// *******************************************
// synchronous methods
// *******************************************

// Backendless.Counters approach
public void Backendless.Counters.Reset( String counterName );

// IAtomic approach
IAtomic<T> counter = Backendless.Counters.Of<T>( String counterName );
public void counter.Reset();

// *******************************************
// asynchronous methods
// *******************************************

// Backendless.Counters approach
public void Backendless.Counters.Reset( String counterName, AsyncCallback<Object> callback );

// IAtomic approach
IAtomic<T> counter = Backendless.Counters.Of<T>( String counterName );
public void counter.Reset( AsyncCallback<Object> callback );

where:

Argument                Description
counterName name of the counter to reset.
callback the callback used for asynchronous calls to indicate that the operation has either successfully completed or resulted in error.

Example

AsyncCallback<Object> callback = new AsyncCallback<Object>(
  result =>
  {
    System.Console.WriteLine( "[ASYNC]counter has been reset" );
  },
  fault =>
  {
     System.Console.WriteLine( "Error - " + fault );
  } );

Backendless.Counters.Reset( "my counter", callback );

IAtomic<int> myCounter = Backendless.Counters.Of<int>( "my counter" );
myCounter.Reset();
System.Console.WriteLine( "[SYNC] counter has been reset" );

Backendless.Counters.Reset( "my counter" );
System.Console.WriteLine( "[SYNC] counter has been reset" );