Ejemplo n.º 1
0
        private static IList <MemberInfo> GetCacheMembers(Type type, string key)
        {
            Dictionary <string, List <MemberInfo> > dictionary;

            if (!LuaVarObject.cachedMemberInfos.TryGetValue(type, out dictionary))
            {
                dictionary = (LuaVarObject.cachedMemberInfos[type] = new Dictionary <string, List <MemberInfo> >());
                LuaVarObject.CollectTypeMembers(type, ref dictionary);
            }
            return(dictionary[key]);
        }
Ejemplo n.º 2
0
 private static void CollectTypeMembers(Type type, ref Dictionary <string, List <MemberInfo> > membersMap)
 {
     MemberInfo[] members = type.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
     for (int i = 0; i < members.Length; i++)
     {
         MemberInfo        memberInfo = members[i];
         List <MemberInfo> list;
         if (!membersMap.TryGetValue(memberInfo.Name, out list))
         {
             List <MemberInfo> list2 = new List <MemberInfo>();
             membersMap[memberInfo.Name] = list2;
             list = list2;
         }
         list.Add(memberInfo);
     }
     if (type.BaseType != null)
     {
         LuaVarObject.CollectTypeMembers(type.BaseType, ref membersMap);
     }
 }