Throw instead of returning zero

This commit is contained in:
Dean Herbert 2020-04-20 15:50:48 +09:00
parent 2ab4a7293e
commit e61a90d469
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ public static IEnumerable<T> GetValuesInOrder<T>()
if (type.GetField(i.ToString()).GetCustomAttributes(typeof(OrderAttribute), false).FirstOrDefault() is OrderAttribute attr) if (type.GetField(i.ToString()).GetCustomAttributes(typeof(OrderAttribute), false).FirstOrDefault() is OrderAttribute attr)
return attr.Order; return attr.Order;
return 0; throw new ArgumentException($"Not all values of {nameof(T)} have {nameof(OrderAttribute)} specified.");
}); });
} }
} }