internal static ParamsObject CreateFromStaticObject(object obj) { Type t = obj.GetType(); ParamsObject ret = new ParamsObject(); foreach (var p in t.GetProperties()) { var r = Attribute.IsDefined(p, typeof(ParamAttribute)); if (!r) { continue; } object propValue = p.GetValue(obj); if (propValue != null) { if (propValue.GetType() == typeof(List <string>)) { string newValue = ""; foreach (object item in (IList)propValue) { if (newValue.Length > 0) { newValue += " \r\n"; } newValue += item.ToString(); } propValue = newValue; } ret.Add(p.Name, propValue); } } return(ret); }
private void Expand(ParamsObject paramsObj) { foreach (KeyValuePair <string, object> param in paramsObj) { storage.Add(param.Key, param.Value); } }
internal static ParamsObject CreateFromStaticObject(object obj) { Type t = obj.GetType(); ParamsObject ret = new ParamsObject(); foreach (var p in t.GetProperties()) { var r = Attribute.IsDefined(p, typeof(ParamAttribute)); if (!r) continue; object propValue = p.GetValue(obj); if (propValue != null) { if (propValue.GetType() == typeof(List<string>)) { string newValue = ""; foreach (object item in (IList)propValue) { if (newValue.Length > 0) newValue += " \r\n"; newValue += item.ToString(); } propValue = newValue; } ret.Add(p.Name, propValue); } } return ret; }
private void Expand(ParamsObject paramsObj) { foreach (KeyValuePair<string, object> param in paramsObj) { storage.Add(param.Key, param.Value); } }
public static ParamsObject operator +(ParamsObject paramsObj1, ParamsObject paramsObj2) { var res = new ParamsObject(); if (paramsObj1 != null) { res.Expand(paramsObj1); } if (paramsObj2 != null) { res.Expand(paramsObj2); } return(res); }
public static ParamsObject operator +(ParamsObject paramsObj1, ParamsObject paramsObj2) { var res = new ParamsObject(); if (paramsObj1 != null) { res.Expand(paramsObj1); } if (paramsObj2 != null) { res.Expand(paramsObj2); } return res; }