private bool getWorkerParent(ref Worker w, string command) { string resp; if (command.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length < 2) { Console.WriteLine("Please enter a node to get the parent of"); resp = Console.ReadLine(); } else { resp = command.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)[1]; } int ASN; if (!int.TryParse(resp, out ASN)) { Console.WriteLine("invalid ASN."); return false; } Console.WriteLine("Parent of " + ASN + " in the worker is " + w.GetParent(ASN)); return true; }