Beispiel #1
0
        public ShadowAttributes Clone()
        {
            // Shallow clone, assuming that attributes values are vauetypes.
            var newShadowAttributes = new ShadowAttributes(Container, Key);

            Attributes.CopyTo(ref newShadowAttributes.Attributes);
            return(newShadowAttributes);
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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);
        }