<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.0-preview.2.21154.6" />

ActivityEvent

public struct ActivityEvent
Represents an event containing a name and a timestamp, as well as an optional list of tags.
using System.Collections.Generic; using System.Runtime.CompilerServices; namespace System.Diagnostics { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public readonly struct ActivityEvent { private static readonly ActivityTagsCollection s_emptyTags = new ActivityTagsCollection(); public string Name { get; } public DateTimeOffset Timestamp { get; } [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2 })] public IEnumerable<KeyValuePair<string, object>> Tags { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2 })] get; } public ActivityEvent(string name) { this = new ActivityEvent(name, DateTimeOffset.UtcNow, s_emptyTags); } public ActivityEvent(string name, DateTimeOffset timestamp = default(DateTimeOffset), [System.Runtime.CompilerServices.Nullable(2)] ActivityTagsCollection tags = null) { Name = (name ?? string.Empty); Tags = (tags ?? s_emptyTags); Timestamp = ((timestamp != default(DateTimeOffset)) ? timestamp : DateTimeOffset.UtcNow); } } }