草庐IT

lblStatus

全部标签

c# - 可能的意外引用比较

我有以下给出警告的代码Possibleunintendedreferencecomparison;togetavaluecomparison,castthelefthandsidetotype'string'`if(lblStatus.Content=="ACTIVE"){//Dostuff}else{//DootherStuff}我假设警告是因为lblStatus.Content不一定总是字符串类型?我已尝试使用以下各项修复它,但我仍然收到警告if(lblStatus.Content.ToString()=="ACTIVE")if((string)lblStatus.Content=

c# - 可能的意外引用比较

我有以下给出警告的代码Possibleunintendedreferencecomparison;togetavaluecomparison,castthelefthandsidetotype'string'`if(lblStatus.Content=="ACTIVE"){//Dostuff}else{//DootherStuff}我假设警告是因为lblStatus.Content不一定总是字符串类型?我已尝试使用以下各项修复它,但我仍然收到警告if(lblStatus.Content.ToString()=="ACTIVE")if((string)lblStatus.Content=