Remove allocation for empty Activity.Baggage/Tags (dotnet/corefx#38389)
authorStephen Toub <stoub@microsoft.com>
Tue, 11 Jun 2019 18:28:40 +0000 (11:28 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2019 18:28:40 +0000 (11:28 -0700)
commit14c7e590fc8568530ead38cc34de7444ed346f15
tree2b49bef4024b808c5bae7d538f13a29b31c6aa23
parent13097de2294c485bb11a90277555b37a599d3572
Remove allocation for empty Activity.Baggage/Tags (dotnet/corefx#38389)

Accessing Activity.Baggage/Tags allocates an enumerable, even when there is no baggage or tags.  This fast-paths the empty case.

Commit migrated from https://github.com/dotnet/corefx/commit/ec93eb4e8a0b225c1bfca093396328e6ba1fe9d2
src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs