UdfMethodAttribute class

Marks a function as a user-defined function (UDF) method.


Namespace:  Microsoft.Office.Excel.Server.Udf
Assembly:  Microsoft.Office.Excel.Server.Udf (in Microsoft.Office.Excel.Server.Udf.dll)

public sealed class UdfMethodAttribute : Attribute

To use custom functions in a class as Excel Services UDFs, you should mark your UDF methods with this attribute. Any methods that are not marked with this attribute in the UDF assembly are ignored by Excel Calculation Services. They are not considered Excel Services UDF methods.

using System;
using Microsoft.Office.Excel.Server.Udf;

namespace MyExcelServicesUdf
    [UdfClass]public class MyUdfs
        [UdfMethod]public int MyFunction()
            i = (i + 88) * 2;
            return i;

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.