Ejemplo n.º 1
0
        /// <summary>
        /// Normalizes the collection of <see cref="IniSection"/>.
        /// </summary>
        /// <param name="normalizer">The normalizer to use</param>
        /// <param name="source">The source to normalize</param>
        /// <param name="destination">The normalized collection</param>
        /// <returns>True if instance normalized successfully, otherwise false</returns>
        public static bool TryNormalize(
            this IIniNormalizer normalizer, IEnumerable <IniProperty> source, out ICollection <IniProperty> destination)
        {
            if (normalizer == null)
            {
                throw new ArgumentNullException(nameof(normalizer));
            }

            destination = new List <IniProperty>();
            return(normalizer.TryNormalizeInto(source, destination));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Normalizes the collection of <see cref="IniSection"/>.
        /// </summary>
        /// <param name="normalizer">The normalizer to use</param>
        /// <param name="source">The source to normalize</param>
        /// <param name="destination">The normalized collection</param>
        /// <returns>True if instance normalized successfully, otherwise false</returns>
        public static bool TryNormalize(
            this IIniNormalizer normalizer, IReadOnlyCollection <IniSection> source, out ICollection <IniSection> destination)
        {
            if (normalizer == null)
            {
                throw new ArgumentNullException(nameof(normalizer));
            }

            destination = new List <IniSection>(source.Count);
            return(normalizer.TryNormalizeInto(source, destination));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a normalized <see cref="IniContainer"/> using the provided one.
        /// </summary>
        /// <param name="normalizer">The normalizer to use</param>
        /// <param name="source">The container to normalize</param>
        /// <param name="destination">The container with the normalization result</param>
        /// <returns>True if instance normalized successfully, otherwise false</returns>
        public static bool TryNormalize(
            this IIniNormalizer normalizer, IniContainer source, out IniContainer destination)
        {
            if (normalizer == null)
            {
                throw new ArgumentNullException(nameof(normalizer));
            }

            var tmpDestination = new IniContainer();

            if (normalizer.TryNormalizeInto(source, tmpDestination))
            {
                destination = tmpDestination;
                return(true);
            }

            destination = null;
            return(false);
        }