It depends heavily on the flow of the program you are designing. I am not too sure what you are trying to accomplish, but if you specify in the method signature that you want to return an integer, then you have to return an integer; i.e. no matter what path is chosen.
E.g. if you know that your method always returns a possitive integer when the method returns as you would like, then you could return -1 for the case where if fails to return what you would like.
Code:
public int ShowContinents(string xmlFileName, string Name)
{
...
if(Node.HasChildNodes)
{
for(int i = 0; i < lstadd.Count; i++)
{
if(addList[i].Attributes["name"].InnerText == Name)
{
...
return returnValue; // returnValue always possitive.
}
}
}
return -1;
}
When you call your method ShowContinents you can ask if it is -1 or not. This is just an example, however, remember to return from all paths.
HtH, Jacob.