Activity.SetBaggage(String, String) Method


Add or update the Activity baggage with the input key and value. If the input value is null - if the collection has any baggage with the same key, then this baggage will get removed from the collection. - otherwise, nothing will happen and the collection will not change. If the input value is not null - if the collection has any baggage with the same key, then the value mapped to this key will get updated with the new input value. - otherwise, the key and value will get added as a new baggage to the collection. Baggage item will be updated/removed only if it was originaly added to the current activity. Items inherited from the parents will not be changed/removed, new item would be added to current activity baggage instead.

 System::Diagnostics::Activity ^ SetBaggage(System::String ^ key, System::String ^ value);
public System.Diagnostics.Activity SetBaggage (string key, string? value);
member this.SetBaggage : string * string -> System.Diagnostics.Activity
Public Function SetBaggage (key As String, value As String) As Activity



The baggage key name


The baggage value mapped to the input key



this for convenient chaining.

Applies to