2013-06-17 2 views
0

Я скачал cloud control в C# использует IEnumerable для countOccurence, сортировки и фильтрации я хотел сделать метод, который поможет мне добавить IWord (строка текста, внутр встречаемости)реализует IEnumerable, чтобы добавить объект IWord

другие методы

public static IEnumerable<IWord> CountOccurences(this IEnumerable<string> terms) 
    { 
     return 
      terms.GroupBy(
       term => term, 
       (term, equivalentTerms) => new Word(term, equivalentTerms.Count()), 
       StringComparer.InvariantCultureIgnoreCase) 
       .Cast<IWord>(); 
    } 
public static IEnumerable<string> Filter(this IEnumerable<string> terms, IBlacklist blacklist) 
    { 
     return 
      terms.Where(
       term => !blacklist.Countains(term)); 



    } 

ответ

0
public static IEnumerable<IWord> AddOwnItems(this IEnumerable<string> terms) 
    { 
     IEnumerable<IWord> obj = new List<IWord>() 
     { 
      new Word("Development", 12), new Word("Extractor", 24), new Word("Anyother", 18) 
     ,new Word("wao", 12),new Word("yours", 18),new Word("how does", 28),new Word("coudnt", 20),new Word("adkj", 22), 
     new Word("own", 12),new Word("items", 10),new Word("terms ", 14),new Word("whats", 12),new Word("uupp", 16), 
     new Word("Zar E Ahmer", 36),new Word("Cool", 26),new Word("Yhoo", 18),new Word("I am", 14),new Word("never", 16), 
     new Word("thirty May", 12),new Word("string", 10),new Word("nothing", 14),new Word("much", 12),new Word("Disney", 16) 
     }; 
     return obj; 

    } 

я использую этот код, чем моя проблема решена