/// <summary> /// Implements the | operator. /// </summary> /// <param name="optionsA">The options a.</param> /// <param name="optionsB">The options b.</param> /// <returns>The result of the operator.</returns> public static IDiceRollOptions operator |(DiceRollOptions optionsA, IDiceRollOptions optionsB) { if (optionsA == null && optionsB == null) { return(null); } if (optionsA == null) { return(new DiceRollOptions(optionsB)); } if (optionsB == null) { return(new DiceRollOptions(optionsA)); } var options = new DiceRollOptions(optionsA); foreach (var option in optionsB) { options.Add(option); } return(options); }
/// <summary> /// Implements the & operator. /// </summary> /// <param name="optionsA">The options a.</param> /// <param name="optionsB">The options b.</param> /// <returns>The result of the operator.</returns> public static IDiceRollOptions operator &(DiceRollOptions optionsA, IDiceRollOptions optionsB) { if (optionsA == null || optionsB == null) { return(null); } var options = new DiceRollOptions(); foreach (IDiceRollOption option in optionsA) { if (optionsB.Contains(option)) { options.Add(option); } } return(options); }