PostSharp 6.10 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Diagnostics.​Transactions.​Model Namespace / Transaction­Policy­Expression­Functions Class / Transaction­Policy­Expression­Functions Methods / Transaction­Policy­Expression­Functions.​Once­Every­XSeconds Method

TransactionPolicyExpressionFunctions.OnceEveryXSeconds Method

Returns true if the method has not returned true for the same key for a period of time.

Namespace:  PostSharp.Patterns.Diagnostics.Transactions.Model
Assembly:  PostSharp.Patterns.Diagnostics.Configuration (in PostSharp.Patterns.Diagnostics.Configuration.dll) Version: (
public static bool OnceEveryXSeconds(
	double seconds,
	string key


Type: System.Double
An amount of time in seconds.
Type: System.String
An arbitrary key. Required but can be empty.

Return Value

Type: Boolean

Note that the side effect of calling this method, in case it returns true, is to set a timestamp for the specified key so that the next call to the method with the same value of key will return false unless it is called later than after the given time span. This is a side effect of calling this method and is not dependent of the actual result of the sampling expression. That is, the side effect will occur even in a combined expression like OnceEveryXSeconds( 1, "foo") && false.

This function is only available in the Sample expression.

See Also