internal IEnumerable GetCustomAttributes(Type ownerType, string memberName)
 {
     MutableAttributeTable.AttributeList expandedAttributes = this.GetExpandedAttributes(ownerType, (object)memberName, (MutableAttributeTable.GetAttributesCallback)((typeToGet, callbackParam) =>
     {
         string key = (string)callbackParam;
         MutableAttributeTable.TypeMetadata typeMetadata;
         if (this._metadata.TryGetValue(typeToGet, out typeMetadata))
         {
             if (typeMetadata.MemberAttributes == null && typeMetadata.TypeAttributes != null && !typeMetadata.TypeAttributes.IsExpanded)
             {
                 lock (this._syncLock)
                 {
                     this.ExpandAttributes(ownerType, typeMetadata.TypeAttributes);
                     typeMetadata.TypeAttributes.IsExpanded = true;
                 }
             }
             MutableAttributeTable.AttributeList attributeList;
             if (typeMetadata.MemberAttributes != null && typeMetadata.MemberAttributes.TryGetValue(key, out attributeList))
             {
                 return(attributeList);
             }
         }
         return((MutableAttributeTable.AttributeList)null);
     }));
     if (expandedAttributes != null)
     {
         return((IEnumerable)expandedAttributes.AsReadOnly());
     }
     return((IEnumerable)MutableAttributeTable._empty);
 }
 private MutableAttributeTable.AttributeList GetAssemblyList(Assembly assembly)
 {
     MutableAttributeTable.AttributeList attributeList;
     if (!this._assemblyAttributes.TryGetValue(assembly, out attributeList))
     {
         attributeList = new MutableAttributeTable.AttributeList();
         this._assemblyAttributes.Add(assembly, attributeList);
     }
     return(attributeList);
 }
 private MutableAttributeTable.AttributeList GetMemberList(Type ownerType, string memberName)
 {
     MutableAttributeTable.TypeMetadata typeMetadata = this.GetTypeMetadata(ownerType);
     if (typeMetadata.MemberAttributes == null)
     {
         typeMetadata.MemberAttributes = new Dictionary <string, MutableAttributeTable.AttributeList>();
     }
     MutableAttributeTable.AttributeList attributeList;
     if (!typeMetadata.MemberAttributes.TryGetValue(memberName, out attributeList))
     {
         attributeList = new MutableAttributeTable.AttributeList();
         typeMetadata.MemberAttributes.Add(memberName, attributeList);
     }
     return(attributeList);
 }
 private void ExpandAttributes(Type type, MutableAttributeTable.AttributeList attributes)
 {
     if (attributes.IsExpanded)
     {
         return;
     }
     for (int index = 0; index < attributes.Count; ++index)
     {
         for (AttributeCallback attributeCallback = attributes[index] as AttributeCallback; attributeCallback != null; attributeCallback = index >= attributes.Count ? (AttributeCallback)null : attributes[index] as AttributeCallback)
         {
             attributes.RemoveAt(index);
             AttributeCallbackBuilder builder = new AttributeCallbackBuilder(this, type);
             attributeCallback(builder);
         }
     }
 }
 private void AddAssemblyMetadata(Assembly assembly, MutableAttributeTable.AttributeList attributes)
 {
     MutableAttributeTable.AttributeList attributeList;
     if (this._assemblyAttributes.TryGetValue(assembly, out attributeList))
     {
         if (!attributes.IsExpanded)
         {
             attributeList.IsExpanded = false;
         }
         attributeList.AddRange((IEnumerable <object>)attributes);
     }
     else
     {
         this._assemblyAttributes.Add(assembly, attributes);
     }
 }
 internal IEnumerable GetCustomAttributes(Type type)
 {
     MutableAttributeTable.AttributeList expandedAttributes = this.GetExpandedAttributes(type, (object)null, (MutableAttributeTable.GetAttributesCallback)((typeToGet, callbackParam) =>
     {
         MutableAttributeTable.TypeMetadata typeMetadata;
         if (this._metadata.TryGetValue(typeToGet, out typeMetadata))
         {
             return(typeMetadata.TypeAttributes);
         }
         return((MutableAttributeTable.AttributeList)null);
     }));
     if (expandedAttributes != null)
     {
         return((IEnumerable)expandedAttributes.AsReadOnly());
     }
     return((IEnumerable)MutableAttributeTable._empty);
 }
 private MutableAttributeTable.AttributeList GetExpandedAttributes(Type type, object callbackParam, MutableAttributeTable.GetAttributesCallback callback)
 {
     MutableAttributeTable.AttributeList attributes = callback(type, callbackParam);
     if (attributes != null && !attributes.IsExpanded)
     {
         lock (attributes)
         {
             if (!attributes.IsExpanded)
             {
                 lock (this._syncLock)
                 {
                     this.ExpandAttributes(type, attributes);
                     attributes.IsExpanded = true;
                 }
             }
         }
     }
     return(attributes);
 }
 private static void AddAttributes(MutableAttributeTable.AttributeList list, IEnumerable <object> attributes)
 {
     list.AddRange(attributes);
 }