Member 'object.Equals(object, object)' cannot be accessed with an instance reference; qualify it with a type name instead

后端 未结 7 516
粉色の甜心
粉色の甜心 2021-01-17 10:59

When I used the following code in C#...

int totalValue = 0;
int total = 0;
totalValue = int.Parse(Session[\"price\"].ToString()) * int.Parse(Session[\"day\"]         


        
7条回答
  •  無奈伤痛
    2021-01-17 12:01

    totalValue += string.Equals(Session["IsChauffeurUsed"].ToString(), "Yes", StringComparison.CurrentCultureIgnoreCase) ? 80 : 0;
    

    (I couldn't compile that to test it, but I think it should work)

提交回复
热议问题