/// <summary>
        /// Replaces/adds the overriden attributes
        /// </summary>
        private void doAttributeOverrides(DynPropertyOverride dynProp, List <Attribute> newAttributeList)
        {
            int iAttrIndex;

            foreach (DynAttribute dynAttribute in dynProp.Overrides)
            {
                iAttrIndex = -1;
                if (dynAttribute.Value == null)
                {
                    continue;
                }
                for (int iCurAttrIndex = 0; iCurAttrIndex < newAttributeList.Count; iCurAttrIndex++)
                {
                    if (dynAttribute.Equals(newAttributeList[iCurAttrIndex]))
                    {
                        iAttrIndex = iCurAttrIndex;
                        break;
                    }
                }

                if (iAttrIndex != -1)
                {
                    newAttributeList.RemoveAt(iAttrIndex);
                    newAttributeList.Insert(iAttrIndex, dynAttribute.Value);
                }
                else
                {
                    newAttributeList.Add(dynAttribute.Value);
                }
            }
        }
Example #2
0
 public DynamicPropDescriptor(Object instance,
                              PropertyDescriptor origPropertyDescriptor,
                              DynPropertyOverrideList dynamicProps,
                              DynPropertyOverride dynProp,
                              Attribute[] attributes)
     : base(origPropertyDescriptor.Name, attributes)
 {
     mInstance     = instance;
     mOrigProp     = origPropertyDescriptor;
     mDynamicProps = dynamicProps;
     mDynProp      = dynProp;
     //            CreateAttributeCollection();
 }