예제 #1
0
        public static LogState Properties(this LogState builder, ICollection <KeyValuePair <string, string> > collection)
        {
            if (collection == null)
            {
                return(builder);
            }

            foreach (var pair in collection)
            {
                if (pair.Key != null)
                {
                    builder.Property(pair.Key, pair.Value);
                }
            }

            return(builder);
        }
예제 #2
0
        public static LogState Tag(this LogState builder, IEnumerable <string> tags)
        {
            var tagList = new List <string>();

            if (builder.ContainsProperty("Tags") && builder["Tags"] is List <string> )
            {
                tagList = builder["Tags"] as List <string>;
            }

            foreach (string tag in tags)
            {
                if (!tagList.Any(s => s.Equals(tag, StringComparison.OrdinalIgnoreCase)))
                {
                    tagList.Add(tag);
                }
            }

            return(builder.Property("Tags", tagList));
        }