Akka.Configuration.Hocon.HoconObject.GetOrCreateKey C# (CSharp) Метод

GetOrCreateKey() публичный Метод

Retrieves the value associated with the supplied key. If the supplied key is not found, then one is created with a blank value.
public GetOrCreateKey ( string key ) : HoconValue
key string The key associated with the value to retrieve.
Результат HoconValue
        public HoconValue GetOrCreateKey(string key)
        {
            if (Items.ContainsKey(key))
            {
                return Items[key];
            }
            var child = new HoconValue();
            Items.Add(key, child);
            return child;
        }

Usage Example

Пример #1
0
 /// <summary>
 /// Wraps this <see cref="HoconValue"/> into a new <see cref="Config"/> object at the specified key.
 /// </summary>
 /// <param name="key">The key designated to be the new root element.</param>
 /// <returns>A <see cref="Config"/> with the given key as the root element.</returns>
 public Config AtKey(string key)
 {
     var o = new HoconObject();
     o.GetOrCreateKey(key);
     o.Items[key] = this;
     var r = new HoconValue();
     r.Values.Add(o);
     return new Config(new HoconRoot(r));
 }
All Usage Examples Of Akka.Configuration.Hocon.HoconObject::GetOrCreateKey