/// <summary> /// ジャンルをすべて取得します。 /// </summary> public TopicGenre[] GetGenreList(){ TopicGenre[] result = new TopicGenre[myGenreDic.Count]; myGenreDic.Values.CopyTo(result, 0); Array.Sort(result, TopicGenre.GenreCountSort); return result; }
/// <summary> /// ジャンルをすべて取得します。 /// </summary> protected TopicGenre[] GetGenreList(){ Dictionary<string, TopicGenre> myGenreDic = new Dictionary<string, TopicGenre>(); foreach(Topic t in GetAllTopics()){ foreach(string s in t.Genre){ if(!myGenreDic.ContainsKey(s)) myGenreDic.Add(s, new TopicGenre(s)); myGenreDic[s].Add(t); } } TopicGenre[] result = new TopicGenre[myGenreDic.Count]; myGenreDic.Values.CopyTo(result, 0); Array.Sort(result, TopicGenre.GenreCountSort); return result; }