ReSharper 10.0 Help

Choose Macro

ReSharper | Tools | Templates Explorer [template type] | [template] | Edit Template | [template parameter] | Choose Macro (Change Macro)

This dialog box helps specify a template macro that ReSharper should use to suggest or guess values for each template parameter. You will use this dialog box when you declare or edit template parameters.

Reference__Choose_Macro__dialog_box

The dialog contains a set of template macros described below.

ExpressionDescriptionDetails
tagNamespace() Tag namespaceInserts namespace of containing tag
    tagName() Tag nameInserts name of containing tag without namespace
      suggestXmlTagName() Suggests XML tag nameSuggests XML tag name used in current document
        suggestAttributeName() Suggests XML attribute nameSuggests XML attribute name used in current document
          suggestXmlAttributeNameByTag() Suggests XML attribute name by tagSuggests XML attribute name used in the same tags in current document
            fullTagName() Full tag nameInserts full name of containing tag
              suggestTagName() Suggest tag nameSuggest tag name used in current document
                suggestAttributeValue() Suggest attribute valueSuggest attribute value for current html tag attribute
                  suggestAttributeNameByTag() Suggests attribute name by tagSuggests attribute name used in the same tags in current document
                    runAtServer() Insert runat="server" if server-side tag selectedInsert runat="server" if server-side tag selected
                      AspMvcController() ASP.NET MVC ControllerShow completion list with available ASP.NET MVC Controllers at the point where the variable is evaluated
                        AspMvcAction() ASP.NET MVC ActionShow completion list with available ASP.NET MVC Actions at the point where the variable is evaluated
                          AspMasterpageContentGenerator() ASP.NET Masterpage content generatorGenerate content for masterpage content placeholders at the point where the variable is evaluated
                            fileheader() File headerInserts the file header specified in the ReSharper options.
                              castToLeftSideType() Cast to the required type (if the cast is necessary)Inserts (if required) cast to the type which is expected at the left side of assignment expression.
                                cppContainingTypeName() Containing type name [C++]Evaluates to short name of the most inner containing type. [C++]
                                  cppFileheader() File header [C++]Inserts the file header specified in the ReSharper options. [C++]
                                    dependencyPropertyType() DependencyProperty typeEvaluates to dependency property type specific to current framework
                                      getUserName() Short name of the current userEvaluates current user name
                                        suggestVariableType() Suggest type for a new variableSuggest type for a new variable declared in the template
                                          variableOfType() Suggest variable of typeSuggests variables of the specified type.

                                          Macro parameters:

                                          • type - type
                                          suggestVariableName() Suggest name for a variableWhen exectuted in variable declaration (where variable name should stand), suggests name for the variable.
                                            suggestIndexVariable() Suggest name for an index variableSuggests non-used name which can be used for an index variable at the evaluation point.
                                              enumerableVariable() Suggest enumerable variableSuggests visible variable that can be enumerated (that is, used in foreach loop as collection)
                                                getSolutionName() Current solution nameEvaluates current solution name
                                                  getProjectName() Name of the current projectEvaluates current project name
                                                    parameterOfType() Suggest parameter of typeSuggests parameters of the specified type.

                                                    Macro parameters:

                                                    • type - type
                                                    getOutputName() Current project output assembly nameEvaluates output assembly name for the current project
                                                      lineNumber() Current line numberEvaluates to number of the line macro is evaluated at.
                                                        guid() New GUIDGenerates new Globally Unique Identifier (GUID)
                                                          guessValueType() Guess value type of dictionary represented by variableAnalyzes code and guesses type of value of a dictionary collection.

                                                          Macro parameters:

                                                          • variable - reference to another parameter in the template
                                                          guessKeyType() Guess key type of dictionary represented by variableAnalyzes code and guesses type of key of a dictionary collection.

                                                          Macro parameters:

                                                          • variable - reference to another parameter in the template
                                                          guessExpectedType() Guess type expected at this pointGuess type expected at this point
                                                            guessExpectedElementType() Guess element type for expected collection typeGuess element type if a collection type is expected at this point
                                                              guessElementType() Guess element type of collection represented by variableAnalyzes code and guesses type of element of a collection.

                                                              Macro parameters:

                                                              • variable - reference to another parameter in the template
                                                              getFullUserName() Full user name of the current userEvaluates full name of the current user
                                                                getAlphaNumericFileNameWithoutExtension() Current file name without extension with all non-alphanumeric replaced with underscoresEvaluates current file name without extension with all non-alphanumeric replaced with underscores
                                                                  getFileName() Current file nameEvaluates current file name
                                                                    fileDefaultNamespace() Default namespace for current fileGets default namespace for the current file
                                                                      getDefaultNamespace() Default namespaceGets default namespace for the current project
                                                                        decapitalize() Value of another variable with the first character in lower caseDecapitalizes string value (i.e. changes case of the first letter to lower)

                                                                        Macro parameters:

                                                                        • another variable - reference to another parameter in the template
                                                                        getCurrentNamespace() Containing namespaceEvaluates name of the containing namespace
                                                                          getCurrentTime() Current date and time in specified formatEvaluates current date

                                                                          Macro parameters:

                                                                          • format - text string
                                                                          getCurrentDate() Current date in specified formatEvaluates current date

                                                                          Macro parameters:

                                                                          • format - text string
                                                                          context() Provides list of items describing current contextProvides list of items describing current context. This includes file name, containing type name, namespace name, etc.
                                                                            typeName() Containing type nameEvaluates to short name of the most inner containing type.
                                                                              typeMember() Containing type member nameEvaluates to short name of the most inner containing type member (e.g. method or property).
                                                                                constant() Constant value Evaluates to the specified constant value.

                                                                                Macro parameters:

                                                                                • Constant value - text string
                                                                                completeType() Execute type completionShow type completion list at the point where the variable is evaluated
                                                                                  completeSmart() Execute smart completionShow smart code completion list at the point where the variable is evaluated
                                                                                    complete() Execute basic completionShow basic code completion list at the point where the variable is evaluated
                                                                                      clipboard() Clipboard contentEvaluates to current textual clipboard content
                                                                                        capitalize() Value of another variable with the first letter in upper caseCapitalizes string value (i.e. changes case of the first letter to upper)

                                                                                        Macro parameters:

                                                                                        • another variable - reference to another parameter in the template
                                                                                        fixedTypeName() Insert reference to typeEvaluates to selected type name.

                                                                                        Macro parameters:

                                                                                        • type - type
                                                                                        arrayVariable() Suggest an array variableSuggests variable which type is array type
                                                                                          spacestounderstrokes() Value of another variable, where spaces will be replaced with '_'Changes spaces to '_' (i.e. "do something useful" into "do_something_useful"

                                                                                          Macro parameters:

                                                                                          • another variable - reference to another parameter in the template
                                                                                          list() Comma-delimited list of values Displays the specified list of values.

                                                                                          Macro parameters:

                                                                                          • Comma-delimited list of values - text string
                                                                                          getCreationTime() Date and time when the file was created in specified formatEvaluates file creation date and time

                                                                                          Macro parameters:

                                                                                          • format - text string
                                                                                          getFileNameWithoutExtension() Current file name without extensionEvaluates current file name without extension

                                                                                            See Also

                                                                                            Last modified: 8 January 2016