Is there a simpler way to do this if statement in C#

后端 未结 7 1436
说谎
说谎 2021-01-21 03:05

I have the following:

if (model.PartitionKey.Substring(2, 2) == \"05\" || 
    model.PartitionKey.Substring(2, 2) == \"06\")

I have more like t

7条回答
  •  礼貌的吻别
    2021-01-21 03:57

    var keyString = model.PartitionKey.Substring(2, 2);
    if (keyString == "05" || keyString == "06")
    {
        // ...
    }
    

提交回复
热议问题