Predefined Variables

Top  Previous  Next

The predefined variables provided by MZ-Tools to be used in templates are specified below. Note that not all the predefined variables are supported in every kind of template (file header, class header, etc.).

  • Selected Text ($P[SELECTED_TEXT]): the text currently selected in the document. This variable is useful to enclose the selected text with some code above and below. For example, to add an exception handler to a selected code or to enclose it in a region.
  • Comment Prefix ($P[COMMENT_PREFIX]): the prefix that the .NET language of the document uses to comment lines. For example, C# uses the // prefix while VB.NET uses the ' prefix. This variable is useful to create templates with comments that can be used by documents in several .NET languages.
  • XML Comment Prefix ($P[XML_COMMENT_PREFIX]): the prefix that the .NET language of the document uses for XML comments. For example, C# uses the /// prefix. This variable is useful to create templates with XML comments that can be used by documents in several .NET languages.
  • Author ($P[AUTHOR]): the user who is adding the template. You can customize in the General section of the Personal Options window whether you want to use the Windows username or a specific username.
  • Company ($P[COMPANY]): the name of your company. You can customize its value in the General section of the Corporate Options window.
  • Assembly Version ($P[ASSEMBLY_VERSION]): this is the value of the AssemblyVersion attribute specified in the AssemblyInfo file of the project, and it represents the version of the assembly. In .NET, assemblies have an assembly file version and an assembly version. The assembly file version is the traditional concept of Win32 file version, that is, the version that you should change in each build. The assembly version is a .NET-only concept that allows to do versioning with the assemblies (in the GAC, for example). So, for instance, you can check in the properties window of the System.Windows.Forms.dll assembly of the .NET Framework 1.1 in the GAC that it has an assembly version 1.0.5000.0 while its assembly file version is 1.1.4322.573.
  • Assembly File Version ($P[ASSEMBLY_FILE_VERSION]): this is the value of the AssemblyFileVersion attribute specified in the AssemblyInfo file of the project, and it represents the version of the file of assembly (not to be confused with the version of the assembly). This attribute does not appear always by default in the AssemblyInfo file but you can add it by hand.
  • Date ($P[DATE]): the current date. You can customize the format in the General section of the Corporate Options window.
  • Time ($P[TIME]): the current time. The format is always "HH:mm" and can not be customized.
  • Cursor Position After Insertion ($P[I]): this variable is not replaced by an actual value but it allows you to specify where the text cursor (the caret) should be positioned after the template is inserted in the document.
  • Solution Name ($P[SOLUTION_NAME]): the name of the solution (the file name without the extension).
  • Solution File Name ($P[SOLUTION_FILENAME]): the name without path of the file of the solution.
  • Solution File Name With Path ($P[SOLUTION_FILENAME_WITH_PATH]): the name with path of the file of the solution.
  • Project Name ($P[PROJECT_NAME]): the name of the project of the document where the template is being inserted (the file name without the extension).
  • Project File Name ($P[PROJECT_FILENAME]): the name without path of the file of the project of the document where the template is being inserted.
  • Project File Name With Path ($P[PROJECT_FILENAME_WITH_PATH]): the name with path of the file of the project of the document where the template is being inserted.
  • Project Item Name ($P[PROJECT_ITEM_NAME]): the name of the document where the template is being inserted (the file name without the extension).
  • Project Item File Name ($P[PROJECT_ITEM_FILENAME]): the name without path of the file of the document where the template is being inserted.
  • Project Item File Name With Path ($P[PROJECT_ITEM_FILENAME_WITH_PATH]): the name with path of the file of the document where the template is being inserted.
  • Project Item Kind ($P[PROJECT_ITEM_KIND]): the kind of the file. For example, "Form", "UserControl", "Code", etc.
  • Namespace Full Name ($P[NAMESPACE_FULL_NAME]): the full name of the namespace where the template is being inserted. For example, "MyNamespace1.MyNamespace2".
  • Namespace Name ($P[NAMESPACE_NAME]): the name of the namespace where the template is being inserted.
  • Root VB.NET Namespace ($P[ROOT_VBNET_NAMESPACE]): the root namespace that is set in the properties page of a VB.NET project. On the contrary to C#, this namespace is used even if no namespace is declared explicitly in the source code.
  • Class Full Name ($P[CLASS_OR_STRUCT_FULL_NAME]): the full name of the class where the template is being inserted. For example, "MyNamespace.MyClass".
  • Class Name ($P[CLASS_OR_STRUCT_NAME]): the name of the class where the template is being inserted.
  • Class Kind Description ($P[CLASS_OR_STRUCT_KIND_DESCRIPTION]): the description of the class where the template is being inserted. Although the term "class" is used in some features of MZ-Tools, actually it can be a struct or a module (VB.NET). This variable returns a localized description for the kind of "class".
  • Class Kind Keyword ($P[CLASS_OR_STRUCT_KIND_KEYWORD]): the keyword for the kind of the class where the template is being inserted. Although the term "class" is used in some features of MZ-Tools, actually it can be a struct or a module (VB.NET). This variable returns the keyword used by the .NET language of the document for the kind of "class". For example, in the case of "classes" of the kind struct, the keyword can be "struct" for C#, "Structure" for VB.NET, etc.
  • Procedure Full Name ($P[PROCEDURE_FULL_NAME]): the full name of the procedure where the template is being inserted. For example, "MyNamespace.MyClass.MyProcedure".
  • Procedure Name ($P[PROCEDURE_NAME]): the name of the procedure where the template is being inserted.
  • Procedure Body ($P[PROCEDURE_BODY]): the body of the procedure where the template is being inserted. This variable is useful to insert custom code at the start / end of a procedure.
  • Procedure Kind Description ($[PROCEDURE_KIND_DESCRIPTION]): a localized description of the kind of procedure where the template is being inserted. For example, "Function", "Subroutine", etc.
  • Procedure Kind Keyword ($P[PROCEDURE_KIND_KEYWORD]) (only VB.NET): the keyword for the kind of the procedure where the template is being inserted. For example, "Sub", "Function", etc.
  • Procedure Handled Events ($P[PROCEDURE_HANDLED_EVENTS]) (only VB.NET): the keyword for the list of handled events (after the "Handles" clause of the procedure declaration).
  • Procedure Return Type Name ($P[FUNCTION_RETURN_TYPE_NAME]): the name of the type that the procedure returns, using the .NET Framework name. For example, "Int32".
  • Procedure Return Type Full Name ($P[FUNCTION_RETURN_TYPE_FULL_NAME]): the full name of the type that the procedure returns. For example, "System.Int32".
  • Procedure Return Type Aliased Name ($P[FUNCTION_RETURN_TYPE_ALIASED_NAME]): the alias in the .NET language of the document for the type that the procedure returns. For example, "int" in the case of C# or "Integer" in the case of VB.NET.
  • Procedure Return Type Prefix ($P[FUNCTION_RETURN_TYPE_PREFIX]): the prefix defined in the Nomenclature section of the Corporate Options window for the type that the procedure returns.
  • Parameter Section Begin ($P[PARAMETER_SECTION_BEGIN]): delimiter of the begin of the section that will be repeated for each parameter.
  • Parameter Section End ($P[PARAMETER_SECTION_END]): delimiter of the end of the section that will be repeated for each parameter. It is used along with the previous one.
  • Parameter Name ($P[PARAMETER_NAME]): the names of the parameters of the procedure. One line is generated for each parameter unless the Parameter Section Begin and Parameter Section End predefined variables are used.
  • Parameter Type Name ($P[PARAMETER_TYPE_NAME]): the name of the type of the parameter, using the .NET Framework name. For example, "Int32".
  • Parameter Type Full Name ($P[PARAMETER_TYPE_FULL_NAME]): the full name of the type of the parameter. For example, "System.Int32".
  • Parameter Type Aliased Name ($P[PARAMETER_TYPE_ALIASED_NAME]): the alias in the .NET language of the document for the type of the parameter. For example, "int" in the case of C# or "Integer" in the case of VB.NET.
  • Parameter Modifiers ($P[PARAMETER_MODIFIERS]): the modifiers of the parameter. For example, "ref", "out", etc. for C# or "ByVal", "ByRef", "Optional", etc. for VB.NET.
  • Parameter Padding ($P[PARAMETER_PADDING]): since normally one line is generated for each parameter of the procedure this variable allows you to align the descriptions of the parameters after the names.
  • Parameter Separator (Comma) ($P[PARAMETER_COMMA_SEPARATOR]): the comma character "," if the parameter is not the last one, or the empty character "" if it is the last one. This variable is typically used to build a comma-separated list of parameters in a single line.
  • Parameter Separator (Space) ($P[PARAMETER_SPACE_SEPARATOR]): the space character " " if the parameter is not the last one, or the empty character "" if it is the last one. This variable is typically used to build a comma-separated list of parameters in a single line.

The Replace Text feature of MZ-Tools allows you to use the following predefined variables. This can be useful in composing the replacement text:

  • Found Text ($P[FOUND_TEXT]): the text that has been found according to the search criteria.
  • Found Line ($P[FOUND_LINE]): the whole line where the text has been found.
  • Portion of Line to the Left of Found Text ($P[LEFT_PORTION]): the text in the line before the found text.
  • Portion of Line to the Right of Found Text ($P[RIGHT_PORTION]): the text in the line after the found text.

See Also:

Template Properties

Review Properties

Find / Replace Text