.NET Daily

‘MethodName’ is an ambiguous reference between ‘namespace1’ and ‘namespace2’

Introduction

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.


LATEST POSTS

Tips for Effective IT Projects Estimates 23rd December, 2017

Tips about Project Status Reports 05th October, 2017

Common .NET Exceptions

‘MethodName’ is an ambiguous reference between ‘namespace1’ and ‘namespace2’

Posted on .

Error: ‘MethodName’ is an ambiguous reference between ‘namespace1’ and ‘namespace2’.

Scenario1: Well, this is simple, you have the same method name in both ‘namespace1’ and ‘namespace2’.

Cause of Scenario 1: When you add namespace references that contains the same method name you use in your code, .NET don’t know from where to take the good method and throw the error above.

Resolution of Scenario 1: You have two possibilities:

  • You remove one of the namespaces that has the same method;
  • You add an alias to one of your namespaces if you must keep both of them and then you add in front of the conflicted method the namespace alias. Ex:

Darius

Darius

Darius Dumitrescu is a creative Senior CMS Consultant with in depth .NET knowledge, focused on Web Development and Architecture Design.

There are no comments.

View Comments (0) ...
Navigation