Exemplo n.º 1
0
        internal static bool TryGetResourceInfoAttribute(this Type type, out ResourceInfoAttribute resourceInfoAttribute)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            resourceInfoAttribute = type
                                    .GetCustomAttributes(typeof(ResourceInfoAttribute), false)
                                    .OfType <ResourceInfoAttribute>()
                                    .FirstOrDefault();

            return(resourceInfoAttribute != null);
        }
Exemplo n.º 2
0
 public static bool TryGet(Type type, out ResourceInfoAttribute ria)
 {
     if (type == null)
     {
         throw new ArgumentNullException(nameof(type));
     }
     if (!attributeCache.TryGetValue(type, out ria))
     {
         // Only cache if not null
         var checkAttr =
             type.GetCustomAttributes(typeof(ResourceInfoAttribute), false).OfType <ResourceInfoAttribute>()
             .FirstOrDefault();
         if (checkAttr == null)
         {
             return(false);
         }
         ria = attributeCache.GetOrAdd(type, checkAttr);
     }
     return(ria != null);
 }
Exemplo n.º 3
0
 public bool TryGetResourceInfoForType(Type type, out ResourceInfoAttribute resourceInfo)
 {
     return(this.client.TryGetResourceInfoForType(type, out resourceInfo));
 }
Exemplo n.º 4
0
 public bool TryGetResourceInfoForType(Type type, out ResourceInfoAttribute resourceInfo)
 {
     return(ResourceInfoAttribute.TryGet(type, out resourceInfo));
 }
Exemplo n.º 5
0
 public virtual bool TryGetResourceInfoForType(Type type, out ResourceInfoAttribute resourceInfo)
 {
     return(this.typeMapper.TryGetResourceInfoForType(type, out resourceInfo));
 }