dimanche 22 octobre 2017

c# WPF - Detect if result is 0 , -4 or something else?

I have a method which has result at the end,I would want to detect if number is not 0 and if it's -4. Like

if ( Result != 0)
{
MessageBox.Show("It's bad!")
}
else if ( Result == -4)
{
Thread.Sleep(20000);
MyMethod.TryAgain();
}
else
{
MessageBox.Show("It's good");
}

My problem is that -4 is not 0,so if i get result -4 it takes my Result != 0 method. How can I solve it? Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire