Set Metadata Class

SetMetadata is an IDisposable class that handles addition and removal of measurement-level metadata and parameters.

When SetMetadata is within a using block, the Logging Library automatically removes the metadata and parameters that were added within the scope of the using block. The following .NET syntax example demonstrates addition of a numeric parameter and a string parameter with the using block:

using (var data = run.LogAppendedMetadata())
{
    data.AddNumericParameter("Voltage", 5, "V");
    data.AddStringParameter("Mode", "Common Mode");
    ...
}

If SetMetadata is not within a using block, metadata and parameters added to the SetMetadata object must be removed explicitly:

var data = run.LogAppendedMetadata();

data.AddNumericParameter("Voltage", 5, "V");
data.AddStringParameter("Mode", "Common Mode");
...
data.Dispose();
Note The Dispose() function calls RemoveAllMetadata() and RemoveAllParameters().