SharedData Increment Method C# API
Increments an integer value associated with the specified key in the Shared Data Server.

Namespace: Facilita.Fc.Runtime
Assembly: fc_clr (in fc_clr.dll) Version: 9.4.0.26
Syntax

public int Increment(
	string key,
	int inc
)

Parameters

key
Type: System String
The key against which the value to be incremented is stored.
inc
Type: System Int32
The amount by which to increment.

Return Value

The new, incremented value.
Remarks

The specified key must already be associated with a value, which can be set by calling Set(String, String) or SetInt(String, Int32). If the value associated with key is not an incrementable value then no action takes place.

A negative increment value can be supplied.

Note Note
The keys are case-sensitive.

Examples

The following example demonstrates incrementing a value.
using Facilita.Fc.Runtime;
SharedData sharedData = new SharedData(GetString("sharedDataHost", "localhost"), GetInt("sharedDataPort", 5099));
sharedData.Set("Count", "100");
sharedData.Increment("Count");   // value will = 101
sharedData.Increment("Count", 7);   // value will = 108
See Also