private static void AddMemberMetadata(MutableAttributeTable.TypeMetadata newMd, MutableAttributeTable.TypeMetadata existingMd) { if (newMd.MemberAttributes == null) { return; } if (existingMd.MemberAttributes != null) { foreach (KeyValuePair <string, MutableAttributeTable.AttributeList> keyValuePair in newMd.MemberAttributes) { MutableAttributeTable.AttributeList attributeList; if (existingMd.MemberAttributes.TryGetValue(keyValuePair.Key, out attributeList)) { attributeList.AddRange((IEnumerable <object>)keyValuePair.Value); } else { existingMd.MemberAttributes.Add(keyValuePair.Key, keyValuePair.Value); } } } else { existingMd.MemberAttributes = newMd.MemberAttributes; } }
private MutableAttributeTable.AttributeList GetTypeList(Type type) { MutableAttributeTable.TypeMetadata typeMetadata = this.GetTypeMetadata(type); if (typeMetadata.TypeAttributes == null) { typeMetadata.TypeAttributes = new MutableAttributeTable.AttributeList(); } return(typeMetadata.TypeAttributes); }
private MutableAttributeTable.TypeMetadata GetTypeMetadata(Type type) { MutableAttributeTable.TypeMetadata typeMetadata; if (!this._metadata.TryGetValue(type, out typeMetadata)) { typeMetadata = new MutableAttributeTable.TypeMetadata(); this._metadata.Add(type, typeMetadata); } return(typeMetadata); }
private void AddTypeMetadata(Type type, MutableAttributeTable.TypeMetadata md) { MutableAttributeTable.TypeMetadata existingMd; if (this._metadata.TryGetValue(type, out existingMd)) { MutableAttributeTable.AddAttributeMetadata(md, existingMd); MutableAttributeTable.AddMemberMetadata(md, existingMd); } else { this._metadata.Add(type, md); } }
private static void AddAttributeMetadata(MutableAttributeTable.TypeMetadata newMd, MutableAttributeTable.TypeMetadata existingMd) { if (newMd.TypeAttributes == null) { return; } if (existingMd.TypeAttributes != null) { existingMd.TypeAttributes.AddRange((IEnumerable <object>)newMd.TypeAttributes); } else { existingMd.TypeAttributes = newMd.TypeAttributes; } }
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); }