What about...
if (!string.IsNullOrEmpty(Model.ProductID) && Model.ProductID.Trim() != "0000")
I really don't think there is a feature for your specific case. Not very often people want to check the string for all three of these conditions.
And there is no reason to worry about “optimizing” this code anyway. The && operator is short-circuited, which means that string comparisons will not even happen if the string does not contain some value.
source share