コード例 #1
0
        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}");
        }
コード例 #2
0
 public static IList <PublicationEntry> WithType(this IEnumerable <PublicationEntry> entries,
                                                 PublicationEntryType type) =>
 entries.Where(it => it.Type == type).ToList();