posted on Monday, August 16, 2004 8:39 AM
by
chris_p_bowen
Deborah Kurata on "Best Kept Secrets in .NET"
We had the pleasure of having Deborah Kurata speak at the Boston .NET User Group on Thursday. Amazingly, she took time out of her vacation to speak with us. I have added respect for her since her main reason for coming to Boston in the first place was to see the Museum of Science's Lord of the Rings exhibit. (If you've seen some of her demo apps, you know she's a big fan.)
Deborah spoke on the “Best Kept Secrets in .NET”. I doubt anybody left without learning some nugget of usefulness. The tips she gave are a sampling of what will be included in her Apress book which is coming soon.
Here's a brief summary of the topics she covered:
IDE Tips
- Code window Tab Groups - Right-click on any code window tab and choose either “New Horizonal Tab Group” or “New Vertical Tab Group”
- Code snippets - Drag commonly-used code to the toolbox that you can reuse later (and is available with any project, not just the current one.)
- Clipboard ring - Available from the Toolbox, remembers the “history“ of your cutting and pasting
- Task list - Using as a custom TODO list, adding custom types
- Find in files (CTRL+SHIFT+F) - Allows powerful searches not available in normal Find
- Incremental search (CTRL+I) - Start typing and the IDE will show you matching text in your current code window
- Line numbers - Turn them on with Tools-Options-Text Editor-All Languages-Line Numbers
- Goto (CTRL+G) - Go to a specific line number in your code
- Goto Definition/Reference - Right-click on an identifier/method/etc. in code and see where it is defined or who is calling it
- Navigate backward/forward buttons (w/dropdown) - Two buttons at the top of the IDE which look like pages with left and right arrows over them. Try using the drop-down, which enables you to see the places you were by file.
- IntelliSense - Use CTRL+space either on blank space or after typing some characters to show a context-aware IntelliSense list.
- Full screen (Shift+Alt+Enter) - Useful to quickly clear away all windows except for the code window (Shift+Alt+Enter returns to normal)
- Brace matching - Use CTRL+} (right curly brace) to find the matching brace for the current block
- IDE Commands via Find box - Use CTRL + / to set focus to Find box, then enter a greater-than (>) symbol and start typing to see a list of available commands like “>File.OpenFile“
- Configuration manager - Set up multiple configurations. Example was a “Unit Test“ configuration for including testing harnesses.
- External Tools - Use Tools-External Tools... to map other tools to the Tools menu (and shortcut key combinations)
WinForms Development Tips
- control.HasChildren - Important property used to determine if a control is a container of other controls (e.g. a Panel.) Important if you want to iterate over all controls in a Form
- Error Provider - Use in a form to flag invalid or missing field data
- Parent forms - Use to establish common features and look for your forms
Code Tricks
- Regions (e.g. #region/#endregion - Use to group code into collapsible areas
- XML Documentation - Type “///“ before class or member to get skeleton documentation that you can fill in. Enables IntelliSense for your object.
- Configuration files – Add a file named “app.config” to your root directory and the IDE will build it into YourAppName.exe.config
- VB DirectCast - Recommended in some cases over CType()
- Using/imports aliases - “using“ and “Import“ both allow defining aliases for a given type or namespace (e.g. “using MXYZ = Microsoft.Ex.Why.Zee;“)
- ObsoleteAttribute - Used to mark a method as deprecated. Supply a message that will appear in the IDE when compiled against and optionally a boolean to make the use of that method a compile-time error (instead of a warning.)
Data Tips
- Data Application Block - She encourages use of the block and described how it works
- Viewing a Dataset - Can be difficult in debug mode to open all of the nodes in the Watch/Locals window. Use dataset.GetXML() to view the XML in the immediate window.
- Dataset extended properties - Showed using them to indicate whether certain columns have validation requirements (e.g. requires numeric, requires existence, etc.)
- Database projects - Useful project type in VS that can be used to track, amongst other things, SQL scripts for your stored procedures so they can be version controlled.
-Chris