开发者

Overloading Methods in ExcelDNA

Is it possible to overload methods using ExcelDNA?

For instance, my current code:

    [ExcelFunction(Category = "Test",
        IsVolatile=true)]
    public static String TestMethod()
    {
        return "Hello Everyone";
    }

    [ExcelFunction(Category = "Test",
        IsVolatile = true)]
    public static String TestMethod(String Name)
    {
        return "Hello, " + Name;
    }

It seems like it should be this straightforward, but it doesn't appear to work when you call the methods from Excel - in fact, they don't even appear (but开发者_StackOverflow one would appear if you commented out the other).


I don't think ExcelDna supports function overloading. I think the best way to approach your problem is to write one function that takes one object as a parameter. Then check whether the object is System.Reflection.Missing - if so it means nothing was passed.

Chris

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜