Idempotent Interface
Namespace
System
Assembly
System.Runtime.dll
Definition
public interface Idempotent
{
// Marker interface - no members
}
The Idempotent interface is a marker used to indicate that operations implementing this interface are idempotent, meaning they can be called multiple times without changing the result beyond the initial application.
Usage
Implement the interface on classes whose public methods are guaranteed to be idempotent.
public class CacheUpdater : Idempotent
{
public void Update(string key, string value)
{
// Implementation ensures repeated calls with same parameters
// produce the same state.
// ...
}
}
Remarks
- Idempotent operations are useful in distributed systems to safely retry requests.
- There are no members in this interface; it serves as documentation and for constraint checking.
- Framework libraries may use this marker to apply optimizations or safety checks.
See Also
| Related Types |
|---|
| ICancelable |
| IDeferred |
| System.IO Namespace |