Open sandboxFocus

Method FromTemplate

FromTemplate(TemplateInvocation, object?)

Creates an IStatement by invoking a template specified by a TemplateInvocation.

Declaration
public static IStatement FromTemplate(TemplateInvocation templateInvocation, object? args = null)
Parameters
Type Name Description
TemplateInvocation templateInvocation

Specifies which template to invoke.

object args

Optional arguments to pass to the template.

Returns
Type Description
IStatement

An IStatement that represents the template invocation.

Remarks

This method allows you to invoke a template method and use the result as a statement. The template will be expanded when the aspect is applied, generating the actual C# code at that point.

See Also

FromTemplate(string, object?)

Creates an IStatement obtained by invoking a template specified by its name and optional arguments.

Declaration
public static IStatement FromTemplate(string templateName, object? args = null)
Parameters
Type Name Description
string templateName
object args
Returns
Type Description
IStatement

FromTemplate(string, ITemplateProvider, object?)

Creates an IStatement obtained by invoking a template specified by its name, an ITemplateProvider, and optional arguments.

Declaration
public static IStatement FromTemplate(string templateName, ITemplateProvider templateProvider, object? args = null)
Parameters
Type Name Description
string templateName
ITemplateProvider templateProvider
object args
Returns
Type Description
IStatement

FromTemplate(string, TemplateProvider, object?)

Creates an IStatement obtained by invoking a template specified by its name, a TemplateProvider, and optional arguments.

Declaration
public static IStatement FromTemplate(string templateName, TemplateProvider templateProvider, object? args = null)
Parameters
Type Name Description
string templateName
TemplateProvider templateProvider
object args
Returns
Type Description
IStatement