Skip to main content
.NET 6.0+

ICustomCriteriaOperatorQueryable.GetMethodInfo() Method

When implemented by a class, returns the metadata of a method associated with a custom criterion used in LINQ to XPO expressions.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

MethodInfo GetMethodInfo()

Returns

Type Description
MethodInfo

A MethodInfo object which identifies the method to be used to evaluate a custom function associated with a custom criterion, based on specified function parameters.

Remarks

The code below shows a sample GetMethodInfo implementation.

public class MyConcatFunction : ICustomFunctionOperatorBrowsable, ICustomFunctionOperatorFormattable, 
    ICustomCriteriaOperatorQueryable {
    const string FunctionName = nameof(MyConcat);
    public string ICustomFunctionOperator.Name {
        get { return FunctionName; }
    }
    // ...

    // The method name must match the function name 
    // returned by the ICustomFunctionOperator.Name property implementation.
    public static string MyConcat(params string[] strings) {
        StringBuilder sb = new StringBuilder();
        foreach(string str in strings) {
            sb.Append(str);
        }
        return sb.ToString();
    }

    #region ICustomCriteriaOperatorQueryable Members
    public System.Reflection.MethodInfo GetMethodInfo() {
        return typeof(MyConcatFunction).GetMethod(FunctionName);
    }
    #endregion
}

To see the entire example, see the How to: Implement Custom Functions and Criteria in LINQ to XPO.

See Also