示例#1
0
        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);
        }
示例#2
0
 public static T Find <T>(this IContract contract)
     where T : IContract
 {
     return(CompositeExtensions.SelectMany(contract).OfType <T>().FirstOrDefault());
 }