Ambiguous match found.

B

Ben

Hi

I have just created a new ASP .net web project and when i run the project I
receieve this error:

System.Reflection.AmbiguousMatchException: Ambiguous match found.

Any help would be much appreciated

Thanks
B
 
K

Kevin Spencer

Hi Ben,

Suppose you have 2 namespaces, foo and bar.

Each namespace has a class with the same name: foo.ClassA and bar.ClassA

You've imported the namespaces for your convenience, so you don't have to
use the namespace when you type your code:

Imports foo
Imports bar

Now, you type the following code:

Public Snafu AS ClassA = new ClassA()

Which class is instantiated? foo.ClassA or bar.ClassA?

The name "ClassA" is ambiguous because without the namespace, the compiler
can't tell which class in which namespace you mean.

Ambiguity has a certain quality to it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
B

Ben

Thanks Kevin

My own fault for not checking the Web Form Designer Generated Code.

Many thanks

B
 
Joined
Mar 23, 2010
Messages
1
Reaction score
0
Kevin Spencer said:
Hi Ben,

Suppose you have 2 namespaces, foo and bar.

Each namespace has a class with the same name: foo.ClassA and bar.ClassA

You've imported the namespaces for your convenience, so you don't have to
use the namespace when you type your code:

Imports foo
Imports bar

Now, you type the following code:

Public Snafu AS ClassA = new ClassA()

Which class is instantiated? foo.ClassA or bar.ClassA?

The name "ClassA" is ambiguous because without the namespace, the compiler
can't tell which class in which namespace you mean.

Ambiguity has a certain quality to it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Ben" <[email protected]> wrote in message
news:[email protected]...
> Hi
>
> I have just created a new ASP .net web project and when i run the project
> I receieve this error:
>
> System.Reflection.AmbiguousMatchException: Ambiguous match found.
>
> Any help would be much appreciated
>
> Thanks
> B
>
Hi Kevin,

This is my frist blog on this site. What you saying is correct, but what I found is it occurs even if we declare Private variables with same name. Say for eg if I declare lstABC and if same name with upper case for dropdown LstABC.


Thanks
Vaibhav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top