Skip to main content
A newer version of this page is available. .
All docs
V21.2

ReportCustomFunctionOperatorBase Class

A base class for custom functions in the Expression Editor.

Namespace: DevExpress.XtraReports.Expressions

Assembly: DevExpress.XtraReports.v21.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public abstract class ReportCustomFunctionOperatorBase :
    IReportCustomFunctionOperator,
    ICustomFunctionOperatorBrowsable,
    ICustomFunctionOperator,
    ICustomFunctionCategory

Remarks

To create a custom function, create an object that descends from the ReportCustomFunctionOperatorBase abstract class.

The following code defines a custom function (NewLineConstant) that inserts a new line symbol:

using DevExpress.XtraReports.Expressions;
using System;
// ...
    public class NewLineConstant : ReportCustomFunctionOperatorBase
    {
        public override string FunctionCategory 
            => "String";
        public override string Description 
            => "NewLineConstant()\r\nInserts a new line.";
        public override bool IsValidOperandCount(int count) 
            => count == 0;
        public override bool IsValidOperandType(int operandIndex, int operandCount, Type type)
            => true;
        public override int MaxOperandCount => 0;
        public override int MinOperandCount
            => -1;
        public override object Evaluate(params object[] operands)
        {
            return Environment.NewLine;
        }
        public override string Name
            => "NewLineConstant";
        public override Type ResultType(params Type[] operands)
        {
            return typeof(string);
        }
    }

Call the static CustomFunctions.Register method at application startup to register a custom function.

Inheritance

Object
ReportCustomFunctionOperatorBase
See Also