scott oliver

scott oliver

  • 1.9k
  • 52
  • 2.8k

need help with returning bool value

Apr 19 2019 9:09 PM
Its been a while since I used c# and I am having the hardest time figuring out how to return a bool value. Instead of a copy all and paste I will try to give a short version.
I have 3 classes
inside program.cs I have 
public static void main()
   pingDsDs.pingDs dsPing = new pingDsDs.pingDs();
Inside pingDs.cs I have 
namespace Pinger
   class pingDsDb
      public class pingDs
      public bool pingable(bool isPingable)
         bool canPing = isPingable;
         return canPing;
public void pingDsDb1()
   inside here I have code to ping my target. 
I need to return if true or false to Program.cs if the object is pingable. if its not pingable I need to call the other class pingEs which is all the same code except it pings a different target. 
What i am trying to do at the end is create a service that pings a system constantly and if it doesnt respond then I need it to ping the other system and change the host file until the preferable host comes up. I have everything else working except returning the success of the ping back to the calling class. I hope I make sense to someone and can get some help on this.  

Brought to you by:

Answers (1)