I have this function:
public bool IsValidProduct(int productTypeId)
{
bool isValid = false;
if (productTypeId == 10 ||
productTypeId == 11 ||
productTypeId == 12)
{
isValid = true;
}
return isValid;
}
but I'm wondering if there's an easier way to write it, such as:
public bool IsValidProduct(int productTypeId)
{
bool isValid = false;
if (productTypeId.In(10,11,12))
{
isValid = true;
}
return isValid;
}
I know I could write an extension method to handle this, I'm just curious if there's already something out there or if there's a better way to write it.