Friday, April 23, 2010

VS2010 Generate From Usage Feature

The Generate From Usage feature enables you to use classes and members before you define them. You can generate a stub for any class, constructor, method, property, field, or enum that you want to use but have not yet defined. You can generate new types and members without leaving your current location in code. This minimizes interruption to your workflow.

Generate From Usage supports programming styles such as test-first development.

Using Generate From Usage in Visual Basic

A wavy underline appears under each undefined identifier, and a short underline appears under the rightmost character. When you rest the mouse pointer on the identifier, an error message appears in a tooltip.

To display the appropriate options, you can use one of the following procedures:

  • Rest the mouse pointer on the undefined identifier. A smart tag (an icon) appears. Click the smart tag.

  • Click the undefined identifier, and then press CTRL+. (period).

  • In the Error List window, double-click the corresponding error row.

The options that appear can include the following:

  • Generate property stub

  • Generate field stub

  • Generate method stub

  • Generate class

  • Generate interface

  • Generate new type (for a Class, Structure, Interface, Enum, Delegate, or Module)

The link below details using this feature.

No comments: