I am new to coding and C# and I was wondering if a method gets called multiple times if you use tuples as return value?
This description may lack because I am no native to the english language so here is some example code:
public static (bool Correct, string Output) MyMethod1(int MyArgument)
{
// Do something
return (true, MyOutput);
}
public void Execute()
{
if (MyMethod1(100).Correct)
{
Console.WriteLine(MyMethod1(100).Output);
}
}
So I am wondering if we go through the whole method MyMethod1 twice now or just once because the argument is the same.
Thank you very much.
Also please let me know if I did anyhing wrong, posting this. As I am also new to SO.