Esempio n. 1
0
 private static ITagContext ToTagContext(ITagContext tags)
 {
     if (tags is TagContext)
     {
         return(tags);
     }
     else
     {
         TagContextBuilder builder = new TagContextBuilder();
         foreach (var tag in tags)
         {
             if (tag != null)
             {
                 builder.Put(tag.Key, tag.Value);
             }
         }
         return(builder.Build());
     }
 }
Esempio n. 2
0
 private static ITagContextBuilder ToTagContextBuilder(ITagContext tags)
 {
     // Copy the tags more efficiently in the expected case, when the TagContext is a TagContextImpl.
     if (tags is TagContext)
     {
         return(new TagContextBuilder(((TagContext)tags).Tags));
     }
     else
     {
         TagContextBuilder builder = new TagContextBuilder();
         foreach (var tag in tags)
         {
             if (tag != null)
             {
                 builder.Put(tag.Key, tag.Value);
             }
         }
         return(builder);
     }
 }