Esempio n. 1
0
        public override Dict GetAttrDict(ICallerContext context, object self)
        {
            // Get the entries from the type
            Dict res = new Dict(GetAttrDict(context));

            // Add the entries from the instance
            ISuperDynamicObject sdo = self as ISuperDynamicObject;

            if (sdo != null)
            {
                IAttributesDictionary dict = sdo.GetDict();
                if (dict != null)
                {
                    foreach (KeyValuePair <object, object> val in dict)
                    {
                        object fieldName = val.Key;
                        if (!res.ContainsKey(fieldName))
                        {
                            res.Add(new KeyValuePair <object, object>(fieldName, val.Value));
                        }
                    }
                }
            }
            return(res);
        }
Esempio n. 2
0
        internal static object FromKeys(object[] keys)
        {
            Dict ret = new Dict();

            for (int i = 0; i < keys.Length; i++)
            {
                ret.Add(keys[i], null);
            }
            return(ret);
        }
Esempio n. 3
0
        public IDictionary <object, object> GetAttrDict(ICallerContext context)
        {
            Dict res    = new Dict(__dict__);
            Dict append = TypeCache.SystemState.GetAttrDict(context, this);

            foreach (KeyValuePair <object, object> pair in append)
            {
                res.Add(pair);
            }
            return(res);
        }
Esempio n. 4
0
 internal IDictionary <object, object> GetAttrDict(ICallerContext context)
 {
     if (HaveInterfaces)
     {
         Dict res = new Dict();
         foreach (DynamicType type in interfaces)
         {
             Dict dict = type.GetAttrDict(context, obj);
             foreach (KeyValuePair <object, object> val in dict)
             {
                 if (!res.ContainsKey(val.Key))
                 {
                     res.Add(val);
                 }
             }
         }
         return(res);
     }
     else
     {
         return(new Dict(0));
     }
 }
 public override void Add(object key, object value)
 {
     dict.Add(key, value);
 }
 public void Add(TKey key, TValue value)
 {
     dict.Add(key, value);
 }