public ShadowAttributes Clone() { // Shallow clone, assuming that attributes values are vauetypes. var newShadowAttributes = new ShadowAttributes(Container, Key); Attributes.CopyTo(ref newShadowAttributes.Attributes); return(newShadowAttributes); }
public bool TryGetAttributes(object memberKey, out ShadowAttributes shadowAttributes) { if (memberKey == null) { throw new ArgumentNullException("memberKey"); } shadowAttributes = null; if (attachedAttributesPerKey == null) { return(false); } return(attachedAttributesPerKey.TryGetValue(memberKey, out shadowAttributes)); }
public ShadowAttributes GetAttributes(object memberKey) { if (memberKey == null) { throw new ArgumentNullException("memberKey"); } if (attachedAttributesPerKey == null) { attachedAttributesPerKey = new Dictionary <object, ShadowAttributes>(); } ShadowAttributes shadowAttributes; if (!attachedAttributesPerKey.TryGetValue(memberKey, out shadowAttributes)) { shadowAttributes = new ShadowAttributes(this, memberKey); attachedAttributesPerKey.Add(memberKey, shadowAttributes); } return(shadowAttributes); }