Exemplo n.º 1
0
        /// <summary>
        /// Gets a property from the configuration.
        /// This is the most basic get method for retrieving values of properties.
        /// In a typical implementation  of the <see cref="IConfiguration"/> interface the other get methods
        /// (that return specific data types) will internally make use of this method.
        /// On this level variable substitution is not yet performed. The returned
        /// object is an internal representation of the property value for the passed
        /// in key. It is owned by the <see cref="IConfiguration"/> object. So a caller
        /// should not modify this object. It cannot be guaranteed that this object
        /// will stay constant over time (i.e. further update operations on the
        /// configuration may change its internal state).
        /// </summary>
        /// <param name="key">The property to retrieve</param>
        /// <returns>
        /// The value to which this configuration maps the specified key,
        /// or null if the configuration contains no mapping for this key.
        /// </returns>
        public override object GetProperty(string key)
        {
            object value;

            m_Properties.TryGetValue(key, out value);
            if (value is string && !DelimiterParsingDisabled)
            {
                var list = PropertyConverter.Split((string)value, ListDelimiter, TrimmingDisabled);
                return(list.Count > 1 ? (object)list : list[0]);
            }
            return(value);
        }