When you run CallMethod0
, it returns a string. You need to store the result to a string variable, and then Console.Write the variable. Since you have the method call in there twice, it is running twice.
In other words, change it to:
public static void Main(string[] args)
{
Console.WriteLine("Hello world!");
string result = CallMethod0(); // store the result like this
Console.WriteLine(result); // print the result - don't call the method again
Console.ReadKey();
}
3
solved Method incorrectly being run twice [closed]