Voorbeeld van een internal Class

class Order
{
    private List _orderLines = new List();
    private double DiscountMultiplier = 0.85;

    public void AddOrderLine(OrderLine line)
    {
        _orderLines.Add(line);
    }

    public double OrderTotal()
    {
        double total = 0;
        foreach (OrderLine line in _orderLines)
        {
            total += line.OrderLineTotal(this);
        }
        return total;
    }

    // Nested class
    internal class OrderLine
    {
        public string ProductName { get; set; }
        public int Quantity { get; set; }
        public double Price { get; set; }

        public double OrderLineTotal(Order order)
        {
            return Math.Round(Price * Quantity * order.DiscountMultiplier, 2);
        }
    }
}


{{opmerking.Naam}}:

{{opmerking.OpmerkingText}}

            

Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!