コード例 #1
0
            static List <Item> GetItemsOfType(type T, IItemSet dict)
            {
                List <Item> temp = new List <Item>();

                if (T == typeof(Item) && dict.ContainsKey(T))
                {
                    return(dict[typeof(Item)]);
                }
                if (T.IsSubclassOf(typeof(Item)) &&
                    dict.ContainsKey(T))
                {
                    return(dict[T]);
                }
                foreach (var elem in dict[typeof(Item)])
                {
                    if (elem.GetType() == T)
                    {
                        temp.Add(elem);
                    }
                }
                return(temp);
            }