Example #1
0
        public static int FindIn(ContextInfo c)
        {
            if (c == null)
            {
                return(-1);
            }

            int val = -1;

            if (!_cacheLookup.TryGetValue(c, out val))
            {
                val = c.IndexOf <T>();
                if (val < 0)
                {
                    throw new ComponentIsNotInContextException(typeof(T), c);
                }

                _cacheLookup[c] = val;
            }

            return(val);
        }
Example #2
0
 internal static int IndexOf <T>(this ContextInfo info) where T : IComponent
 {
     return(info.IndexOf(typeof(T)));
 }