<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="5.0.0-preview.6.20305.6" />

ActivityEvent

public struct ActivityEvent
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 IEnumerable<KeyValuePair<string, object>> s_emptyAttributes = new Dictionary<string, object>(); public string Name { get; } public DateTimeOffset Timestamp { get; } [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] public IEnumerable<KeyValuePair<string, object>> Attributes { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 1 })] get; } public ActivityEvent(string name) { this = new ActivityEvent(name, DateTimeOffset.UtcNow, s_emptyAttributes); } public ActivityEvent(string name, DateTimeOffset timestamp) { this = new ActivityEvent(name, timestamp, s_emptyAttributes); } public ActivityEvent(string name, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 1, 1 })] IEnumerable<KeyValuePair<string, object>> attributes) { this = new ActivityEvent(name, default(DateTimeOffset), attributes); } public ActivityEvent(string name, DateTimeOffset timestamp, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 1, 1 })] IEnumerable<KeyValuePair<string, object>> attributes) { Name = (name ?? string.Empty); Attributes = (attributes ?? s_emptyAttributes); Timestamp = ((timestamp != default(DateTimeOffset)) ? timestamp : DateTimeOffset.UtcNow); } } }