docs icon indicating copy to clipboard operation
docs copied to clipboard

Code is incorrect

Open Loves2Code opened this issue 7 years ago • 0 comments

Though the example Console app is conceptually correct, the "return;" statement needs to return something convertible to a StreamWriter or "null;"

Incorrect code:

static StreamWriter OpenStream(string path) { if (path is null) { Console.WriteLine("You did not supply a file path."); return; }

Possible correct code:

static StreamWriter OpenStream(string path) { if(path is null) { Console.WriteLine("You did not supply a file path (at least, not a correct one!)."); return null; }


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Loves2Code avatar Dec 14 '18 15:12 Loves2Code