Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ReportCustomFunctionOperatorBase Class

A base class for custom functions in the Expression Editor.

Namespace: DevExpress.XtraReports.Expressions

Assembly: DevExpress.XtraReports.v24.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;
namespace CustomFunctionForExpressionEditorExample
{
    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