Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created June 24, 2022 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/8d2d47968d6bc262b091c29047a42ba0 to your computer and use it in GitHub Desktop.
Save lgolubyev/8d2d47968d6bc262b091c29047a42ba0 to your computer and use it in GitHub Desktop.
var tags = new List<KeyValuePair<string, object?>>()
{
new KeyValuePair<string, object?>("tag1", "value1"),
new KeyValuePair<string, object?>("tag2", "value2"),
};
ActivityLink link = new ActivityLink(default, new ActivityTagsCollection(tags));
foreach (ref readonly KeyValuePair<string, object?> tag in link.EnumerateTagObjects())
{
// Consume the link tags without any extra allocations or value copying.
}
ActivityEvent e = new ActivityEvent("SomeEvent", tags: new ActivityTagsCollection(tags));
foreach (ref readonly KeyValuePair<string, object?> tag in e.EnumerateTagObjects())
{
// Consume the event's tags without any extra allocations or value copying.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment