public static IEnumerable <string> GetSearchableProperties <T>() { IEnumerable <PropertyInfo> Properties = typeof(T).GetTypeInfo().GetProperties().Where(x => x.IsAttributeDefined <SearchableAttribute>()); List <string> FinalProperties = new List <string>(); foreach (PropertyInfo PropInfo in Properties) { SearchableAttribute Atrr = PropInfo.GetCustomAttribute <SearchableAttribute>(); if (Atrr != null && Atrr.ContainsSearchable) { try { DescriptionAttribute DescAttr = PropInfo.PropertyType.GetTypeInfo().GetCustomAttribute <DescriptionAttribute>(); string Front = String.Empty; if (DescAttr != null) { Front = $"{DescAttr.Description}."; } FinalProperties.AddRange(PropInfo.PropertyType.GetTypeInfo().GetProperties().Where(x => x.IsAttributeDefined <SearchableAttribute>()).Select(x => $"{Front}{x.Name}")); } catch (Exception) { } } else { FinalProperties.Add(PropInfo.Name); } } return(FinalProperties); }