public static IContract Add(this IContract lhs, IContract rhs) { if (lhs == null) { return(rhs); } if (rhs == null) { return(lhs); } var lhsItems = CompositeExtensions.SelectMany(lhs); var rhsItems = CompositeExtensions.SelectMany(rhs); var contract = new CompositeContract(lhsItems.Concat(rhsItems)); return(contract); }
public static T Find <T>(this IContract contract) where T : IContract { return(CompositeExtensions.SelectMany(contract).OfType <T>().FirstOrDefault()); }