Class MacroMethod
- Namespace
- CMS.MacroEngine
- Assembly
- CMS.MacroEngine.dll
Macro method object.
public class MacroMethod : MacroExtension, IMacroMethod
- Inheritance
-
objectMacroMethod
- Implements
- Inherited Members
- Extension Methods
Constructors
MacroMethod()
Creates new MacroMethod object.
public MacroMethod()
MacroMethod(string, Func<EvaluationContext, object[], object>)
Creates new instance of MacroMethod object.
public MacroMethod(string name, Func<EvaluationContext, object[], object> method)
Parameters
namestringMethod name
methodFunc<EvaluationContext, object[], object>Method delegate
MacroMethod(string, Func<MacroResolver, object[], object>)
Creates new instance of MacroMethod object.
public MacroMethod(string name, Func<MacroResolver, object[], object> method)
Parameters
namestringMethod name
methodFunc<MacroResolver, object[], object>Method delegate
MacroMethod(string, Func<object[], object>)
Creates new instance of MacroMethod object.
public MacroMethod(string name, Func<object[], object> method)
Parameters
namestringMethod name
methodFunc<object[], object>Method delegate
Properties
AllowedTypes
Gets or sets a list of types for which the method is applicable (set to null for all types to be allowed).
public List<Type> AllowedTypes { get; set; }
Property Value
- List<Type>
Comment
Gets or sets a comment for the method.
public string Comment { get; set; }
Property Value
- string
IsHidden
If true, the method won't be visible in IntelliSense (but will be normally executed when called).
public bool IsHidden { get; set; }
Property Value
- bool
IsObsolete
Indicates whether method is obsolete.
public bool IsObsolete { get; set; }
Property Value
- bool
Method
Gets or sets reference to a method.
public Func<object[], object> Method { get; set; }
Property Value
- Func<object[], object>
MethodContext
Gets or sets reference to a method.
public Func<EvaluationContext, object[], object> MethodContext { get; set; }
Property Value
- Func<EvaluationContext, object[], object>
MethodResolver
Gets or sets reference to a method.
public Func<MacroResolver, object[], object> MethodResolver { get; set; }
Property Value
- Func<MacroResolver, object[], object>
MinimumParameters
Gets or sets the minimal number of parameters needed by the method.
public int MinimumParameters { get; set; }
Property Value
- int
MovedFromNamespace
Original namespace the method was moved from. The method usage with the specified namespace is considered as obsolete.
public string MovedFromNamespace { get; set; }
Property Value
- string
- See Also
ObsoleteMessage
The message that describes alternative workarounds.
public string ObsoleteMessage { get; set; }
Property Value
- string
Parameters
Gets or sets the parameters for the method.
public List<IMacroMethodParam> Parameters { get; set; }
Property Value
- List<IMacroMethodParam>
Snippet
Gets or sets a code snippet which is used in AutoCompletion when TAB is pressed (for determining the cursor position use pipe).
public string Snippet { get; set; }
Property Value
- string
SpecialParameters
Gets or sets the list of special parameters needed to be supplied by resolver.
public string[] SpecialParameters { get; set; }
Property Value
- string[]
Type
Gets or sets a return type of the method.
public Type Type { get; set; }
Property Value
- Type
Methods
AddParameter(IMacroMethodParam)
Adds parameter to the method definition.
public void AddParameter(IMacroMethodParam parameter)
Parameters
parameterIMacroMethodParamParameter
AddParameter(string, Type, string, bool, bool)
Adds parameter to the method definition.
public void AddParameter(string name, Type type, string comment, bool isParams = false, bool asExpression = false)
Parameters
namestringName of the parameter
typeTypeType of the parameter
commentstringComment of the parameter
isParamsboolIf true, parameter is declared with params keyword
asExpressionboolIf true, the parameter is passed to the method as expression (MacroExpression object), not evaluated
ExecuteMethod(EvaluationContext, params object[])
Executes given method with parameters.
public object ExecuteMethod(EvaluationContext context, params object[] parameters)
Parameters
contextEvaluationContextResolver object
parametersobject[]Method parameters
Returns
- object
ExecuteMethod(params object[])
Executes given method with parameters.
public object ExecuteMethod(params object[] parameters)
Parameters
parametersobject[]Method parameters
Returns
- object
GetParameterComment(int)
Returns a comment of the index-th parameter.
public string GetParameterComment(int index)
Parameters
indexintIndex of the parameter
Returns
- string
GetParameterName(int)
Returns a name of the index-th parameter.
public string GetParameterName(int index)
Parameters
indexintIndex of the parameter
Returns
- string
GetParameterType(int)
Returns a type of the index-th parameter.
public Type GetParameterType(int index)
Parameters
indexintIndex of the parameter
Returns
- Type