示例#1
0
        /// <summary>
        /// Adds new <see cref="PropertyParser{T}"/> with <paramref name="sourceName"/> and parse func <paramref name="parseFunc"/>.
        /// </summary>
        /// <typeparam name="T">Property type.</typeparam>
        /// <param name="sourceName">Source name.</param>
        /// <param name="parseFunc">Parse value function.</param>
        /// <returns><see cref="PropertyParser{T}"/>.</returns>
        public static PropertyParser <T> Source <T>(string sourceName, Func <string, Option <T> > parseFunc)
        {
            PropertyParser <T> propertyParser = new PropertyParser <T>(sourceName, new ValueParser <T>(parseFunc), null);

            return(propertyParser);
        }
示例#2
0
        /// <summary>
        /// Adds new <see cref="PropertyParser{T}"/> with <paramref name="sourceName"/> .
        /// </summary>
        /// <param name="sourceName">Source name.</param>
        /// <returns><see cref="PropertyParser{T}"/> of string.</returns>
        public static PropertyParser <string> Source(string sourceName)
        {
            PropertyParser <string> propertyParser = new PropertyParser <string>(sourceName, StringParser.Default, null);

            return(propertyParser);
        }
示例#3
0
        /// <summary>
        /// Adds new <see cref="PropertyParser{T}"/> with <paramref name="sourceName"/> and <paramref name="valueParser"/>.
        /// </summary>
        /// <typeparam name="T">Property type.</typeparam>
        /// <param name="sourceName">Source name.</param>
        /// <param name="valueParser">Value parser.</param>
        /// <returns><see cref="PropertyParser{T}"/>.</returns>
        public static PropertyParser <T> Source <T>(string sourceName, IValueParser <T> valueParser)
        {
            PropertyParser <T> propertyParser = new PropertyParser <T>(sourceName, valueParser, null);

            return(propertyParser);
        }