-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomFormatFunction.cs
33 lines (32 loc) · 1.16 KB
/
CustomFormatFunction.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using DevExpress.XtraReports.Expressions;
using System;
namespace CustomFunctionForExpressionEditorExample
{
public class CustomFormatFunction : ReportCustomFunctionOperatorBase
{
public override string FunctionCategory
=> "String";
public override string Description
=> "CustomFormatFunction(string format, object arg0)" +
"\r\nConverts an arg0 value to a string based on a specified format";
public override bool IsValidOperandCount(int count)
=> count == 2;
public override bool IsValidOperandType(int operandIndex, int operandCount, Type type)
=> true;
public override int MaxOperandCount
=> 2;
public override int MinOperandCount
=> 2;
public override object Evaluate(params object[] operands)
{
string res = String.Format(operands[0].ToString(), operands[1]);
return res;
}
public override string Name
=> "CustomFormatFunction";
public override Type ResultType(params Type[] operands)
{
return typeof(string);
}
}
}