dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.17k stars 5.83k forks source link

Suggestions for improving the Teleprompter Console App tutorial #25876

Open paulfwhite opened 2 years ago

paulfwhite commented 2 years ago

I liked the tutorial approach developing the example and running at each stage. Problem occurred after the making async changes. I missed the change in parameters for ShowTeleprompter and GetInput.

Suggestions for improvement: It would be helpful to have a link or popup to show exactly what the code looks like at each step.

Add words with an example: Open a command prompt and create a new directory for your application. Make that the current directory. Type the command dotnet new console at the command prompt. For example:

E:\development\VSprojects>mkdir teleprompter
E:\development\VSprojects>cd teleprompter
E:\development\VSprojects\teleprompter>dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on E:\development\VSprojects\teleprompter\teleprompter.csproj...
  Determining projects to restore...
  Restored E:\development\VSprojects\teleprompter\teleprompter.csproj (in 78 ms).
Restore succeeded.

Change words: You can call this new method in your Main method: Now replace the code in the Main method with a call to the ShowTeleprompter method:... ShowTeleprompter().Wait(); Save the code and try it out.

Move paragraph: To finish this feature, you need to create a new async Task returning method that starts both of these tasks (GetInput and ShowTeleprompter), and also manages the shared data between these two tasks. Down to the section which creates RunTeleprompter task

Additional words near this paragraph: Put that class in a new file, and enclose that class in the...

Create a new file; it can be any name ending with .cs. For example TelePrompterConfig.cs. Paste in the code above, save and close

Additional line in the TelePrompterConfig class code instead of making it a separate step: using static System.Math;

Change words: You'll also need to add a using static statement... to Note the using static statement allows you to ....

Additional words near: Next, you need to update the ShowTeleprompter and GetInput methods to use the new config object. The config object is being passed as a parameter to these methods. Use copy/paste to completely replace the methods with the new code here. You can see the code is using attributes and calling methods from the config object.

Remove words - I think they are a bit confusing here: This new version of ShowTeleprompter calls a new method in the TeleprompterConfig class

Change words: Write one final Task... to Create a RunTelePrompter task....


Document Details

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

BillWagner commented 2 years ago

Thanks for providing these suggestions @paulfwhite

I've added this to our backlog, and I'll be addressing these after .NET 6 ships.