jeudi 27 février 2020

How to check two string inside if condition

I know this is a bit of a silly question and sorry for that. But I bit confused about this.

I need to check when backToLobbyStatus.ErrorMessage not equal Success or Success2 need to set validationResult = backToLobbyStatus; So I wrote code as,

if ((assistCustomer != null && backToLobbyStatus.ErrorMessage != "Success") || (assistCustomer != null && backToLobbyStatus.ErrorMessage != "Success2")) {
 validationResult = backToLobbyStatus;
}

but when backToLobbyStatus.ErrorMessage == "Success", this conditon assistCustomer != null && backToLobbyStatus.ErrorMessage != "Success2" getting true, What did I do wrong here. How to handle this properly without nested if condtion. or is nested if is the most proper way to handle this error?

Aucun commentaire:

Enregistrer un commentaire