Esempio n. 1
0
        /// <summary>
        /// Creates a deep copy of the <see cref="MessageItemCollection"/>.
        /// </summary>
        /// <returns>A deep copy of the <see cref="MessageItemCollection"/>.</returns>
        public override object Clone()
        {
            MessageItemCollection clone = new MessageItemCollection();

            foreach (MessageItem item in this)
            {
                clone.Add((MessageItem)item.Clone());
            }

            return(clone);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a new <see cref="MessageItemCollection"/> for a selected <see cref="MessageItem.Property"/>.
        /// </summary>
        /// <param name="property">The name of the property that the message relates to.</param>
        /// <returns>A new <see cref="MessageItemCollection"/>.</returns>
        public MessageItemCollection GetMessagesForProperty(string property)
        {
            MessageItemCollection msgs = new MessageItemCollection();

            foreach (MessageItem item in this)
            {
                if (item.Property == property)
                {
                    msgs.Add(item);
                }
            }

            return(msgs);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets a new <see cref="MessageItemCollection"/> for a selected <see cref="MessageType"/>.
        /// </summary>
        /// <param name="type">Message validatorType.</param>
        /// <returns>A new <see cref="MessageItemCollection"/>.</returns>
        public MessageItemCollection GetMessagesForType(MessageType type)
        {
            MessageItemCollection msgs = new MessageItemCollection();

            foreach (MessageItem item in this)
            {
                if (item.Type == type)
                {
                    msgs.Add(item);
                }
            }

            return(msgs);
        }