feat: add label sample

This commit is contained in:
Oli Sturm
2023-11-24 15:52:28 +00:00
parent 2c0f307566
commit 379daa6dd8
+3 -1
View File
@@ -35,7 +35,9 @@ namespace CS9 {
// the element lists must be "complete"! // the element lists must be "complete"!
static OrderValue OrderValueCategory(Order o) => static OrderValue OrderValueCategory(Order o) =>
o switch { o switch {
(< 0, _) => throw new ArgumentException("Positive itemCounts please!"), // Labels are optional here but can be useful
// for readability
(itemCount: < 0, itemPrice: _) => throw new ArgumentException("Positive itemCounts please!"),
(_, < 0) => throw new ArgumentException("Positive itemPrices please!"), (_, < 0) => throw new ArgumentException("Positive itemPrices please!"),
(>= 100, _) => OrderValue.ValuableDueToHighCount, (>= 100, _) => OrderValue.ValuableDueToHighCount,
(_, >= 1000) => OrderValue.ValuableDueToHighItemPrice, (_, >= 1000) => OrderValue.ValuableDueToHighItemPrice,