0
Methods parameters with out keyword
Hi everyone, in tutorial, i have this code: _______________________________________ static void Ask(out string name) { name = Console.ReadLine(); } static void Main(string[] args) { string nm; Ask(out nm); } _______________________________________ I don't see a declaration for "name", I imagine it is implicitly declared in the ASK function. C# is sometimes strange in its syntax and logic ..
2 odpowiedzi
0
Within `Main` method, the string variable <nm> is declared. It then be passed to `Ask` method and will act and be treated as <name> variable wirhin the `Ask` method.
Console input will be assigned to <name> (which actually is <nm>) and the assignment will reflect in the `Main` method.
Is this what you were asking for? cause I'm not too sure I got your question all so clear ...
0
Yes, thanks.