} // DeriveWithBackgroundColor public RtfTextFormat DeriveWithForegroundColor(IRtfColor derivedForegroundColor) { if (derivedForegroundColor == null) { throw new ArgumentNullException(nameof(derivedForegroundColor)); } if (ForegroundColor.Equals(derivedForegroundColor)) { return(this); } var copy = new RtfTextFormat(this); copy.ForegroundColor = derivedForegroundColor; return(copy); } // DeriveWithForegroundColor
} // GetHashCode private bool IsEqual(object obj) { var compare = obj as RtfTextFormat; // guaranteed to be non-null return (compare != null && Font.Equals(compare.Font) && FontSize == compare.FontSize && SuperScript == compare.SuperScript && IsBold == compare.IsBold && IsItalic == compare.IsItalic && IsUnderline == compare.IsUnderline && IsStrikeThrough == compare.IsStrikeThrough && IsHidden == compare.IsHidden && BackgroundColor.Equals(compare.BackgroundColor) && ForegroundColor.Equals(compare.ForegroundColor) && Alignment == compare.Alignment); } // IsEqual