Skip to content

Commit 9b29e49

Browse files
committed
for each
1 parent 8fed3bd commit 9b29e49

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/SIL.XForge/Services/EventMetricService.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,10 @@ public async Task SaveEventMetricAsync(
103103
var activity = Activity.Current;
104104
while (activity is not null)
105105
{
106-
foreach (var kvp in activity.Tags)
107-
{
108-
if (!collectedTags.ContainsKey(kvp.Key))
109-
{
110-
collectedTags[kvp.Key] = kvp.Value;
111-
}
112-
}
106+
collectedTags = activity
107+
.Tags.Where(kvp => !collectedTags.ContainsKey(kvp.Key))
108+
.Union(collectedTags)
109+
.ToDictionary();
113110
activity = activity.Parent;
114111
}
115112

0 commit comments

Comments
 (0)