namespace Tnb.Core; /// /// 字典对象 /// public class DObject : Dictionary { public DObject() { } public DObject(string key, object value) { Add(key, value); } public DObject(Dictionary dictionary) : base(dictionary) { } public void AddCascade(string code, object value) { var keys = code.Split('.'); if (keys.Length == 1) { Add(code, value); return; } for (int i = 0; i < keys.Length; i++) { DObject temp = this; if (i < keys.Length - 1) { if (!ContainsKey(keys[i])) { temp = new DObject(); Add(keys[i], temp); } else { temp = (DObject)temp[keys[i]]; } } else { temp.Add(keys[i], value); } } } }