public static string[] Format(IDictionary <string, string> tags) { if (tags == null) { return(null); } if (tags.Count == 0) { return(new string[0]); } var tagSet = tags .Select(t => new { Key = KeyFormatter.Format(t.Key), Value = TagValueFormatter.Format(t.Value) }) .Where(t => string.IsNullOrWhiteSpace(t.Key) == false && string.IsNullOrWhiteSpace(t.Value) == false) .Select(t => $"{t.Key}={t.Value}") .ToArray(); return(tagSet); }
public static string[] Format(IDictionary <string, object> fields) { if (fields == null) { return(null); } if (fields.Count == 0) { return(new string[0]); } var fieldSet = fields .Select(f => new { Key = KeyFormatter.Format(f.Key), Value = FieldValueFormatter.Format(f.Value) }) .Where(f => string.IsNullOrWhiteSpace(f.Key) == false && string.IsNullOrWhiteSpace(f.Value) == false) .Select(f => $"{f.Key}={f.Value}") .ToArray(); return(fieldSet); }