示例#1
0
        public static string Concatenate([NotNull] NotificationCollection notifications,
                                         [CanBeNull] string separator,
                                         [CanBeNull] string format = null)
        {
            Assert.ArgumentNotNull(notifications, nameof(notifications));

            var sb = new StringBuilder();

            foreach (INotification notification in notifications)
            {
                string message = string.IsNullOrEmpty(format)
                                                         ? notification.Message
                                                         : string.Format(format, notification.Message);

                if (sb.Length == 0)
                {
                    sb.Append(message);
                }
                else
                {
                    sb.AppendFormat("{0}{1}", separator, message);
                }
            }

            return(sb.ToString());
        }
示例#2
0
 public static void Add([CanBeNull] NotificationCollection notifications,
                        [NotNull] string format,
                        params object[] args)
 {
     notifications?.Add(format, args);
 }
示例#3
0
 public static void Add([CanBeNull] NotificationCollection notifications,
                        [NotNull] string message)
 {
     notifications?.Add(message);
 }