Two quick simple techniques for people who need to demo code (as I wait for the traffic in front of my house to recede before getting to work).
Oftentimes, you want to demo some code quickly to people and don't want to type it all in. The Toolbox window is very handy for this. Highlight a bunch of code and drag and drop it to the Toolbox window (View->Toolbox). On my machine I generally put this in the General tab on the Toolbox, but you can put it in the User controls tab too. Now when you are demo'ing and need some quick code, just drag and drop it from the Toolbox where you had it previously stored.
Another cool demo tip I've picked up here, is to use the task list. The task list in C# will show you comments for tokens you specify. So lets say you want to demo some feature in File1.cs line 30 and then in File2.cs at line 40. You can navigate back and forth easily using the task list.
- Go to Tools->Options->Environment->Task List and type in “Demo” in the Name textbox. Click Add.
- Now go to those files locations you want to demo with and add some comments prefixed with Demo like “//DEMO:Show rapid prototyping here”.
- Open your task list and right click on your description pane - make sure the Show Tasks option is selected as “All” or “Comments”.
You should now see the task list automatically populate with your comment. Now when doing a demo, you can just open the task list and click to that code block that you want to show.
Now to fight the traffic...