Esempio n. 1
0
        /// <summary>
        ///     Wraps this <see cref="HoconValue" /> into a new <see cref="HoconObject" /> at the specified key.
        /// </summary>
        /// <param name="key">The key designated to be the new root element.</param>
        /// <returns>A new HOCON root.</returns>
        /// <remarks>
        ///     Immutable. Performs a deep copy on this <see cref="HoconValue" /> first.
        /// </remarks>
        public HoconRoot AtKey(string key)
        {
            var value = new HoconValue(null);
            var obj   = new HoconObject(value);
            var field = new HoconField(key, obj);

            field.SetValue(Clone(field) as HoconValue);
            obj.Add(key, field);
            value.Add(obj);

            return(new HoconRoot(value));
        }