internal static IEnumerable <_IAttributeInfo> GetCustomAttributes( Type type, string assemblyQualifiedAttributeTypeName) { var attributeType = ReflectionAttributeNameCache.GetType(assemblyQualifiedAttributeTypeName); Guard.ArgumentValidNotNull(nameof(assemblyQualifiedAttributeTypeName), $"Could not load type: '{assemblyQualifiedAttributeTypeName}'", attributeType); return(GetCustomAttributes(type, attributeType, GetAttributeUsage(attributeType))); }
static IEnumerable <_IAttributeInfo> GetCustomAttributes( MethodInfo method, string assemblyQualifiedAttributeTypeName) { Guard.ArgumentNotNull(nameof(method), method); Guard.ArgumentNotNull(nameof(assemblyQualifiedAttributeTypeName), assemblyQualifiedAttributeTypeName); var attributeType = ReflectionAttributeNameCache.GetType(assemblyQualifiedAttributeTypeName); Guard.ArgumentValidNotNull(nameof(assemblyQualifiedAttributeTypeName), $"Could not load type: '{assemblyQualifiedAttributeTypeName}'", attributeType); return(GetCustomAttributes(method, attributeType, ReflectionAttributeInfo.GetAttributeUsage(attributeType))); }
/// <inheritdoc/> public IEnumerable <IAttributeInfo> GetCustomAttributes(string assemblyQualifiedAttributeTypeName) { var attributeType = ReflectionAttributeNameCache.GetType(assemblyQualifiedAttributeTypeName); Guard.ArgumentValid("assemblyQualifiedAttributeTypeName", "Could not locate type name", attributeType != null); return(Assembly.CustomAttributes .Where(attr => attributeType.GetTypeInfo().IsAssignableFrom(attr.AttributeType.GetTypeInfo())) .OrderBy(attr => attr.AttributeType.Name) .Select(a => Reflector.Wrap(a)) .Cast <IAttributeInfo>() .ToList()); }
/// <inheritdoc/> public IEnumerable <_IAttributeInfo> GetCustomAttributes(string assemblyQualifiedAttributeTypeName) { var attributeType = ReflectionAttributeNameCache.GetType(assemblyQualifiedAttributeTypeName); Guard.ArgumentValidNotNull(nameof(assemblyQualifiedAttributeTypeName), $"Could not load type: '{assemblyQualifiedAttributeTypeName}'", attributeType); return (Assembly .CustomAttributes .Where(attr => attributeType.IsAssignableFrom(attr.AttributeType)) .OrderBy(attr => attr.AttributeType.Name) .Select(a => Reflector.Wrap(a)) .Cast <_IAttributeInfo>() .ToList()); }
/// <inheritdoc/> public IReadOnlyCollection <_IAttributeInfo> GetCustomAttributes(string assemblyQualifiedAttributeTypeName) { var attributeType = ReflectionAttributeNameCache.GetType(assemblyQualifiedAttributeTypeName); Guard.ArgumentNotNull($"Could not load type: '{assemblyQualifiedAttributeTypeName}'", attributeType, nameof(assemblyQualifiedAttributeTypeName)); return (additionalAssemblyAttributes .Where(customAttribute => attributeType.IsAssignableFrom(customAttribute.Attribute.GetType())) .Concat( Assembly .CustomAttributes .Where(attr => attributeType.IsAssignableFrom(attr.AttributeType)) .OrderBy(attr => attr.AttributeType.Name) .Select(a => Reflector.Wrap(a)) .Cast <_IAttributeInfo>() ) .CastOrToReadOnlyCollection()); }
internal static IEnumerable <IAttributeInfo> GetCustomAttributes(Type type, string assemblyQualifiedAttributeTypeName) { Type attributeType = ReflectionAttributeNameCache.GetType(assemblyQualifiedAttributeTypeName); return(GetCustomAttributes(type, attributeType, GetAttributeUsage(attributeType))); }
static IEnumerable <IAttributeInfo> GetCustomAttributes(MethodInfo method, string assemblyQualifiedAttributeTypeName) { var attributeType = ReflectionAttributeNameCache.GetType(assemblyQualifiedAttributeTypeName); return(GetCustomAttributes(method, attributeType, ReflectionAttributeInfo.GetAttributeUsage(attributeType))); }