I am making the following call to an extension method:
database.ExecuteScalar(command).NoNull(string.Empty);
I get an error t
using
directive.-
Abc.Xyz.ExtensionsClass.NoNull(database.ExecuteScalar(), string.Empty);
You should change the signature of one (or both of them) to differentiate what it does. This seems like duplication of code somewhere unless these do different things. Though if they do different things I would think you would differentiate that in the names. I'd recommend creating some sort of enumeration (a flag maybe) to pass as an extra argument to one of the methods.
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
}
I would strongly suggest that you rename one of the extension methods. Depending on what else you do, you could possibly just remove the using
directive for one of those namespaces, but that won't help if you need both namespaces for other things. (This leads to a suggestion to put extension methods in their own namespace, of course.) Renaming is likely to simplify things in general though.