TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
scott oliver
NA
82
16.1k
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
program.cs
pingDs.cs
pingRs.cs
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.
Reply
Answers (
1
)
Difference between Console.Write and Console.Error.WriteLine
how to can i connect with DataTables CDN without Internet