kryca
❔ Need help with Node LinkedLists
public static void PrintAgentsWithSubscribers(LLAgent agents, LLSubscriber subscribers)
{
Node<Agent> agentNode = agents.Head;
while (agentNode != null)
{
Console.WriteLine("Agent: {0} {1}", agentNode.Data.Surname, agentNode.Data.Name);
Console.WriteLine("Assigned Subscribers:");
Node<Subscriber> subscriberNode = subscribers.Head;
while (subscriberNode != null)
{
if (subscriberNode.Data.AgentCode == agentNode.Data.Code)
{
Console.WriteLine("{0} {1}", subscriberNode.Data.Surname, subscriberNode.Data.Name);
}
subscriberNode = subscriberNode.Next;
}
Console.WriteLine();
agentNode = agentNode.Next;
}
}
Something along the lines of this was my first thought, but .Head is private and im not so sure i can change it to public
15 replies