// <summary> // Adds the contents of the provided attribute table to // this builder. Conflicts are resolved with a last-in-wins // strategy. // </summary> // <param name="table">An existing attribute table.</param> // <exception cref="ArgumentNullException">if table is null</exception> public void AddTable(AttributeTable table) { if (table == null) { throw FxTrace.Exception.ArgumentNull("table"); } MutableTable.AddTable(table.MutableTable); }
// <summary> // Looks up the specified MemberInfo in the custom MetadataStore AttributeTables // and returns any attributes associated with it as an enumeration. This method // does not return any inherited attributes. // </summary> // <param name="type">Type to look up</param> // <param name="memberName">Member name to look up. If null, attributes associated // with the type itself will be returned.</param> // <param name="tables">AttributeTables to look in</param> // <returns>Attributes in the AttributeTables associated with the specified // Type and member name.</returns> internal static IEnumerable<object> GetMetadataStoreAttributes(Type type, string memberName, AttributeTable[] tables) { if (tables == null || tables.Length == 0) { yield break; } foreach (AttributeTable table in tables) { if (table.ContainsAttributes(type)) { IEnumerable attrEnum; if (memberName == null) { attrEnum = table.GetCustomAttributes(type); } else { attrEnum = table.GetCustomAttributes(type, memberName); } foreach (object attr in attrEnum) { yield return attr; } } } }