0

I have a Setting.setting have a setting option : isSent - type int - value : 0

And my code :

 if (Settings.Default.isSent =! 0)
                {
                    var info = _text.ReadFile(Settings.Default.FilePath);
                //Do something
                } else
                {
                //Do something
                }

I install my Windows Service, start and attach it to Visual to debug, and it always run to

var info = _text.ReadFile(Settings.Default.FilePath);

But not run to

} else
{
//Do something
}

like I expect :(

Anyone can explain it and know how to solve this for me ? Appreciate any answer :)

Đức Bùi
  • 517
  • 1
  • 6
  • 22

1 Answers1

0

I just noticed "if (Settings.Default.isSent =! 0)". Should it be "if (Settings.Default.isSent != 0)". Otherwise visual studio will always report error.

by the way, have you tried to attach your source code to the Service and see the value of "Settings.Default.isSent" at runtime?

Yang You
  • 2,618
  • 1
  • 25
  • 32