LayoutFarm.WebDom.CssPropertyAssignmentCollection.Clone C# (CSharp) Method

Clone() public method

public Clone ( object newOwner ) : CssPropertyAssignmentCollection
newOwner object
return CssPropertyAssignmentCollection
        public CssPropertyAssignmentCollection Clone(object newOwner)
        {
            CssPropertyAssignmentCollection newclone = new CssPropertyAssignmentCollection(newOwner);
            Dictionary<WellknownCssPropertyName, WebDom.CssPropertyDeclaration> newCloneDic = newclone._myAssignments;
            foreach (var kp in this._myAssignments)
            {
                newCloneDic.Add(kp.Key, kp.Value);
            }
            return newclone;
        }
        public void MergeProperties(CssPropertyAssignmentCollection sourceCollection)

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
     {
     }
 }