public override bool TryGetMember(GetMemberBinder binder, out object result) { result = _dictionary[binder.Name]; if (result is IDictionary <string, object> ) { result = new DynamicJsonObject(result as IDictionary <string, object>); } else if (result is ArrayList && (result as ArrayList) is IDictionary <string, object> ) { result = new List <DynamicJsonObject>((result as ArrayList).ToArray().Select(x => new DynamicJsonObject(x as IDictionary <string, object>))); } else if (result is ArrayList) { result = new List <object>((result as ArrayList).ToArray()); } return(_dictionary.ContainsKey(binder.Name)); }
public object this[string key] { get { object result = _dictionary[key]; if (result is IDictionary <string, object> ) { result = new DynamicJsonObject(result as IDictionary <string, object>); } else if (result is ArrayList && (result as ArrayList) is IDictionary <string, object> ) { result = new List <DynamicJsonObject>((result as ArrayList).ToArray().Select(x => new DynamicJsonObject(x as IDictionary <string, object>))); } else if (result is ArrayList) { result = new List <object>((result as ArrayList).ToArray()); } return(result); } }