Exemplo n.º 1
0
 /// <summary>
 ///     Enumerates all interfaces that are contained in current components and in evert child component (if any)
 /// </summary>
 public IEnumerable <ComponentInterface> EnumerateContainedSlots()
 {
     foreach (var componentInterface in ContainedSlots)
     {
         yield return(componentInterface);
     }
     foreach (var componentInterface in ContainedComponents.SelectMany(x => x.EnumerateContainedSlots()))
     {
         yield return(componentInterface);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Adds component to configuration
        /// </summary>
        public PCConfiguration WithComponent(PCComponent component)
        {
            Argument.NotNull(component);
            if (ContainedComponents.Any(x => x.SameIdentityAs(component)))
            {
                throw new DuplicateElementException("Component already added");
            }

            ContainedComponents.Add(component);

            return(this);
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Calculates sum price of all included components
 /// </summary>
 public decimal CalculatePrice()
 {
     return(ContainedComponents.Sum(x => x.AveragePrice));
 }