Ejemplo n.º 1
0
        public static Expando operator +(Expando e1, Expando e2)
        {
            if (e1 == null && e2 == null)
            {
                return(null);
            }
            e1 = e1 ?? new Expando();
            e2 = e2 ?? new Expando();
            var result = new Expando(e1);

            e2.Keys.ForEach(k => result.Add(k, e2[k]));
            return(result);
        }
Ejemplo n.º 2
0
        public Object Invoke(InvokeBinder binder, Object[] args)
        {
            var map    = args.ToDictionary((arg, i) => binder.CallInfo.ArgumentNames[i], arg => arg);
            var result = new Expando();

            this.Keys.ForEach(k =>
            {
                var v = this[k];
                var s = (v as String).Extract(@"^\$(?<key>.*)$");
                if (s != null && map.ContainsKey(s))
                {
                    v = map[s];
                }
                result.Add(k, v);
            });

            return(result);
        }