LayoutFarm.WebDom.CssPropertyAssignmentCollection.MergeProperties C# (CSharp) Метод

MergeProperties() публичный Метод

public MergeProperties ( CssPropertyAssignmentCollection sourceCollection ) : void
sourceCollection CssPropertyAssignmentCollection
Результат void
        public void MergeProperties(CssPropertyAssignmentCollection sourceCollection)
        {
            Dictionary<WellknownCssPropertyName, CssPropertyDeclaration> fromDic = sourceCollection._myAssignments;
            Dictionary<WellknownCssPropertyName, CssPropertyDeclaration> targetDic = this._myAssignments;
            foreach (CssPropertyDeclaration sourceAssignment in fromDic.Values)
            {
                //add or replace
                targetDic[sourceAssignment.WellknownPropertyName] = sourceAssignment;
            }
        }

Usage Example

Пример #1
0
 public void AddRuleSet(CssPropertyAssignmentCollection otherAssignments)
 {
     //assignment in this ruleset
     //if (dbugId == 170)
     //{
     //}
     if (_assignments == null)
     {
         //share
         _assignments = otherAssignments;
     }
     else if (_assignments != otherAssignments)
     {
         //then copy each css property assignment
         //from other Assignment and add to this assignment
         if (_assignments.OriginalOwner != this)
         {
             _assignments = _assignments.Clone(this);
         }
         _assignments.MergeProperties(otherAssignments);
     }
     else
     {
     }
 }