iikoFront Api V7Preview7 Code Reference
iikoFront Api V7Preview7 Code Reference
Resto.Front.Api.Attributes.JetBrains
SourceTemplateAttribute Class
SourceTemplateAttribute Constructor
SourceTemplateAttribute Properties
SourceTemplateAttribute Methods

# 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
System
Object
System
Attribute
Resto.Front.Api.Attributes.JetBrains
SourceTemplateAttribute

Namespace: Resto.Front.Api.Attributes.JetBrains
Assembly: Resto.Front.Api.V7Preview7 (in Resto.Front.Api.V7Preview7.dll) Version: 1ca4876affdd3bc5359a98b321fc115a647d2251
Syntax
C#
Copy

    public sealed class SourceTemplateAttribute : Attribute

The SourceTemplateAttribute type exposes the following members.

Constructors

| Name | Description
--- | --- | ---
| SourceTemplateAttribute | Initializes a new instance of the SourceTemplateAttribute class

Top
Properties

| Name | Description
--- | --- | ---
| TypeId | When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.)

Top
Methods

| Name | Description
--- | --- | ---
| Equals | Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)
| GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.)
| GetType | Gets the Type of the current instance. (Inherited from Object.)
| IsDefaultAttribute | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
| Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
| ToString | 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:
Copy

    [SourceTemplate]
    public static void forEach<T>(this IEnumerable<T> xs) {
      foreach (var x in xs) {
         //$ $END$
      }
    }

See Also

#### Reference

Resto.Front.Api.Attributes.JetBrains Namespace