Click or drag to resize
CalculationWorks Logo
Creating Function Classes

This topic contains the following sections.

Simple Function

The example shows a simple function.

The BcfMandatoryAttribute will cause BCF Editor to show an error if the property is not used as parameter.

public class StringLengthFunction : BcfFunctionBase<int> {

    public string StringValue { get; set; }

    public override int Compute() { return StringValue == null ? 0 : StringValue.Length; }
Generic Function

The example shows a function usable for all column data types. BCF Editor will use the column data type as generic type parameter T.

public class BooleanSwitchFunction<T> : BcfFunctionBase<T> {

    public bool Switch { get; set; }

    public T TrueValue { get; set; }

    public T FalseValue { get; set; }

    public override T Compute() { return Switch ? TrueValue : FalseValue; }
See Also