public static string ToLabel(this PublicationEntryType type, string culture) { if (culture.StartsWith("en")) { switch (type) { case PublicationEntryType.Inproceedings: return("Inproceedings"); case PublicationEntryType.TechReport: return("Technical Report"); case PublicationEntryType.Book: return("Book"); case PublicationEntryType.Article: return("Article"); case PublicationEntryType.PhdThesis: return("PhD Thesis"); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } } if (culture.StartsWith("ru")) { switch (type) { case PublicationEntryType.Inproceedings: return("Тезисы"); case PublicationEntryType.TechReport: return("Технический отчёт"); case PublicationEntryType.Book: return("Книга"); case PublicationEntryType.Article: return("Статья"); case PublicationEntryType.PhdThesis: return("Диссертационная работа"); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } } throw new Exception($"Unknown culture: {culture}"); }
public static IList <PublicationEntry> WithType(this IEnumerable <PublicationEntry> entries, PublicationEntryType type) => entries.Where(it => it.Type == type).ToList();