New Method / Property Assistant

Top  Previous  Next

 C#   VB.NET   VB6   VBA 

The New Method / Property Assistant feature allows you to add methods or properties to the source code easily through a window.

MZ-Tools offers the following ways to show the New Method / Property Assistant window:

  • The MZ-Tools | New Method / Property Assistant... menu.
  • The New Method / Property Assistant... menu entry on the context menu of a code window.
  • The New Method / Property Assistant button on the MZ-Tools - Main toolbar.
  • In Visual Studio 2015 and higher, the keyboard shortcut associated with the MZTools.NewMethodAssistant command.
  • In Visual Studio 2013 and lower, the keyboard shortcut associated with the MZTools8.NewMethodAssistant command.
  • In VB6 / VBA, the keyboard shortcut associated with the New Method / Property Assistant feature.

The New Method / Property Assistant window is the following:

NewMethodPropertyAssistant

In this window, you can enter the following:

  • Name: the name of the method or property. For C# indexers, type "this".
  • Add Header: select it if you want to add a header to the method or property (see the Insert Header feature).
  • Access: the access of the method / property.
  • Limit Access: to set a more restrictive access to one of the two methods (get/set) of a property.
  • Method Kind: property, method with return value ("Function" in VB.NET / VB / VBA) or without value ("Sub" in VB.NET / VB / VBA). In the case of properties, you can select the get/set members and the style. For the field name, MZ-Tools generates a name according to the New Method / Property Assistant Options, although you can change it.
  • Modifiers: for example static, sealed, etc. for C# methods or Shared, NotOverridable, etc. for VB.NET methods.
  • Data Type: the return data type of a property or function. It can be a simple .NET type (string, bool, etc.), a class, etc. You can enter the type directly in the editable combobox or you can fill the list with available types clicking the Fill button. You can also set the default value for fields of properties or result variable or methods returning a value.
  • Arguments: the list of parameters of a method.

You can see a preview of the resulting code. When you click the Insert button, the code is inserted into the current code window. You can repeat the operation several times with different values before closing the window.

Remarks:

  • If the current line is a blank line between two method, then the method is inserted at that line. Otherwise, it is appended to the end of the class.
  • You can customize the nomenclature preferences in the Options window, Team Options tab, New Method / Property Assistant section. See New Method / Property Assistant Options.

See Also:

New Method / Property Assistant Options

Insert Header

Headers Options

Keyboard Shortcuts Options