Ambiguous extension method

前端 未结 4 1101
太阳男子
太阳男子 2020-12-28 13:13

I am making the following call to an extension method:

database.ExecuteScalar(command).NoNull(string.Empty);

I get an error t

4条回答
  •  情歌与酒
    2020-12-28 13:29

    Just in case somebody will need this...

    Ambiguity can be resolved if concurrent namespaces which have extension methods with same name, are included at different levels (most inner included namespace will have priority).

    For example:

    using Namespace1;
    namespace MyApplication 
    {
        using Namespace2;
        ...
        db.Execute(); // Namespace2 Execute() will be called
    }
    

提交回复
热议问题