Click or drag to resize

SourceTemplateAttribute Class

An extension method marked with this attribute is processed by ReSharper code completion as a 'Source Template'. When extension method is completed over some expression, it's source code is automatically expanded like a template at call site.
Inheritance Hierarchy
SystemObject
  SystemAttribute
    Resto.Front.Api.Attributes.JetBrainsSourceTemplateAttribute

Namespace:  Resto.Front.Api.Attributes.JetBrains
Assembly:  Resto.Front.Api.V7 (in Resto.Front.Api.V7.dll)
Syntax
C#
public sealed class SourceTemplateAttribute : Attribute

The SourceTemplateAttribute type exposes the following members.

Constructors
  NameDescription
Public methodSourceTemplateAttribute
Initializes a new instance of the SourceTemplateAttribute class
Top
Properties
  NameDescription
Public propertyTypeId
When implemented in a derived class, gets a unique identifier for this Attribute.
(Inherited from Attribute.)
Top
Methods
  NameDescription
Public methodEquals
Returns a value that indicates whether this instance is equal to a specified object.
(Inherited from Attribute.)
Public methodGetHashCode
Returns the hash code for this instance.
(Inherited from Attribute.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsDefaultAttribute
When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Inherited from Attribute.)
Public methodMatch
When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Inherited from Attribute.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks
Template method body can contain valid source code and/or special comments starting with '$'. Text inside these comments is added as source code when the template is applied. Template parameters can be used either as additional method parameters or as identifiers wrapped in two '$' signs. Use the MacroAttribute attribute to specify macros for parameters.
Examples
In this example, the 'forEach' method is a source template available over all values of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block:
[SourceTemplate]
public static void forEach<T>(this IEnumerable<T> xs) {
  foreach (var x in xs) {
     //$ $END$
  }
}
See Also