Exemple #1
0
    public void Add(IWord word)
    {
        bool foundType = false;

        foreach (Type type in WordTypes)
        {
            IWord instance = Activator.CreateInstance(type) as IWord;
            if (instance.IsTypeOf(word))
            {
                if (!StronglyTypedWords.ContainsKey(type))
                {
                    StronglyTypedWords[type] = new Collection <IWord>();
                }
                StronglyTypedWords[type].Add(instance.MakeFrom(word));
                foundType = true;
            }
        }
        if (!foundType)
        {
            UntypedWords.Add(word);
        }
    }