Modifies the metric for consuming values by a specified function, for the push data consumption model.
This method always makes the metric writable; however, its timestamp will not be writable, i.e. Sparkplug host application will not be able to modify them. If you need a different behavior, use one of the WriteFunction(SparkplugMetric,Type,Func<SparkplugData,Boolean>) method overloads instead.
This method does not change the readability access of the metric. By default, metrics are readable. If you need a metric that is writable but non-readable, combine this method with calling Readable(SparkplugMetric,Boolean) method with the 'readable' parameter set to false.
The write function returns a boolean that indicates the outcome of the Sparkplug write operation. If the outcome of your write operation should always be successful, you can make your code a bit simpler by using one of WriteValueAction<TValue>(SparkplugMetric,Type,Action<TValue>) method overloads instead.
Overload List
| Overload | Description |
| WriteValueFunction<TValue>(SparkplugMetric,Type,Func<TValue,Boolean>) | Makes a metric that consumes the Sparkplug data using the write value function. Specify the declared type. |
| WriteValueFunction<TValue>(SparkplugMetric,TypeCode,Func<TValue,Boolean>) | Makes a metric that consumes the Sparkplug data using the write value function. Specify the declared type code. |
| WriteValueFunction<TValue>(SparkplugMetric,SparkplugDataType,Func<TValue,Boolean>) | Makes a metric that consumes the Sparkplug data using the write value function. Specify the declared Sparkplug data type. |
| WriteValueFunction<TValue>(SparkplugMetric,Func<TValue,Boolean>) | Makes a metric that consumes the Sparkplug data using the write value function. The declared type is specified using generic type parameter. |
Requirements
Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows
See Also