public static Combine ( |
||
combined | The child object | |
parent | The parent object | |
return |
/// <summary> /// Combine combines a child with a parent as necessary and returns the combined object /// </summary> /// <param name="combined">The child object</param> /// <param name="parent">The parent object</param> /// <returns>The combined object</returns> public static RelativeTimeRuleSet Combine(RelativeTimeRuleSet combined, RelativeTimeRuleSet parent) { if (combined == null || combined.RelativeTimeRules == null) { return(parent); } else if (parent == null || parent.RelativeTimeRules == null) { return(combined); } List <RelativeTimeRule> combinedRelativeTimeRules = combined.RelativeTimeRules.ToList(); foreach (RelativeTimeRule parentRelativeTimeRule in parent.RelativeTimeRules) { RelativeTimeRule combinedRelativeTimeRule = (from crtr in combinedRelativeTimeRules where crtr.Id == parentRelativeTimeRule.Id select crtr).FirstOrDefault(); if (combinedRelativeTimeRule == null) { combinedRelativeTimeRules.Add(parentRelativeTimeRule); } else { combinedRelativeTimeRule = RelativeTimeRule.Combine(combinedRelativeTimeRule, parentRelativeTimeRule); } } combined.RelativeTimeRules = combinedRelativeTimeRules.ToArray(); return(combined); }
/// <summary> /// Combine combines a child with a parent as necessary and returns the combined object /// </summary> /// <param name="combined">The child object</param> /// <param name="parent">The parent object</param> /// <returns>The combined object</returns> public static RelativeTimeRule Combine(RelativeTimeRule combined, RelativeTimeRule parent) { return combined.Combine<RelativeTimeRule>(parent); }
/// <summary> /// Combine combines a child with a parent as necessary and returns the combined object /// </summary> /// <param name="combined">The child object</param> /// <param name="parent">The parent object</param> /// <returns>The combined object</returns> public static RelativeTimeRule Combine(RelativeTimeRule combined, RelativeTimeRule parent) { return(combined.Combine <RelativeTimeRule>(parent)); }