Пример #1
0
        protected virtual string EnumLikeStr <TEnum>(string str)
            where TEnum : Enum
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return(null);
            }

            var items = EnumExtension.GetEnums <TEnum>().Select(x =>
                                                                (
                                                                    item: x,
                                                                    text: L(x.SouceName()))
                                                                )
                        .ToList();

            var likeItems = items.Where(
                x => x.text.ToUpper().Contains(str.ToUpper())
                ).Select(x => x.item);

            return(string.Join(";", likeItems.Select(x => x.ToString().ToArray())));
        }