public SearchableType(TypeInfo info, TypeLoaderService typeLoaderService, DocumentationLoaderService documentationLoaderService) { Info = info; Members = info.GetAllMembers().Select(x => SearchableMember.Create(x, this, documentationLoaderService)) .Concat(typeLoaderService.ExtensionMethods .Where(x => info.IsAssignableTo(x.GetParameters().First().ParameterType)) .Select(x => SearchableMember.Create(x, this, documentationLoaderService))) .ToList(); Summary = documentationLoaderService.GetSummaryFromInfo(info); }
public static SearchableMember Create(MemberInfo info, SearchableType parent, DocumentationLoaderService documentationLoaderService) { var summary = documentationLoaderService.GetSummaryFromInfo(info); return(info switch { PropertyInfo propertyInfo => new SearchableProperty(propertyInfo, parent, summary), MethodInfo { DeclaringType : { } } methodInfo when methodInfo.DeclaringType == typeof(object) => new HiddenSearchable(methodInfo, parent, summary), MethodInfo methodInfo when methodInfo.IsExtensionMethod() => new SearchableExtensionMethod(methodInfo, parent, summary), MethodInfo methodInfo => new SearchableMethod(methodInfo, parent, summary), FieldInfo fieldInfo => new SearchableField(fieldInfo, parent, summary), EventInfo eventInfo => new SearchableEvent(eventInfo, parent, summary), ConstructorInfo constructorInfo => new SearchableConstructor(constructorInfo, parent, summary), TypeInfo typeInfo => new HiddenSearchable(typeInfo, parent, summary), _ => new SearchableUnknown(info, parent, summary) });