I have the following:
if (model.PartitionKey.Substring(2, 2) == "05" ||
model.PartitionKey.Substring(2, 2) == "06")
I have more like this. Is there a more clean way to code this where I don't have to repeat model.PartitionKey twice ?
I have the following:
if (model.PartitionKey.Substring(2, 2) == "05" ||
model.PartitionKey.Substring(2, 2) == "06")
I have more like this. Is there a more clean way to code this where I don't have to repeat model.PartitionKey twice ?
You can save the substring in a variable:
Or you could use a regular expression:
This probably depends a bit on how easily you can understand a regex while reading code.