Functions\Extensions
-
[MBFunction] attribute can be used on static methods to have them as Function options in MBScript
-
'MBFunctionForType' attribute can be used to set it to show under another type
-
Static C# methods can be exposed as Extensions for MBScript / Wiring, where the first Parameter type is then what it's a extension for (like C# extension methods)
[MBExtension]
static int Length(string Text)
{
if (Text == null)
return 0;
return Text.Length;
}
[MBFunctionQuickOption]
[MBFunctionForType(typeof(string))]
static string NewLine()
{
return System.Environment.NewLine;
}
-
The 'NewLine' can then be used in MBScript like: Func.String.NewLine
-
The 'Length' extension can be used on any value returning a string. Like 'Name.Length'
Updated almost 2 years ago