S
Saul Behr
How to reproduce:
1) Define an enumerator MyEnum in a VB project (VB_Proj_1).
2) Create a C# project C_Proj_2, with a reference to VB_Proj_1
3) Define an interface MyInterface in C_Proj_2, which has a method
referencing MyEnum:
void MyMethod(MyEnum x);
4) Create a new VB project VB_Proj_3, with references to both
VB_Proj_1 and C_Proj_2.
5) Create a class in VB_Proj_3 that implements MyInterface. Then,
using the VB smart editor, select the "MyInterface" interface on the
left drop-down, and "MyMethod" from the right drop-down, giving you
the automatically generated method header:
Public Sub MyMethod(ByVal x as MyEnum) Implements MyInterface.MyMethod
That should work, right? Sorry, no can do. You can move heaven and
earth, but you will not get the .NET compiler to accept any method
implementing MyInterface.MyMethod. It simply does not recognize the
MyEnum enumerator as being the same as that defined in the interface,
and you get the error message, "'MyMethod' cannot implement 'MyMethod'
because there is no matching sub on interface 'MyInterface'.
6) If, however, you shift the definition of MyEnum to another, new, C#
project, everything suddenly works fine & dandy.
For all Microsoft's marketing drivel that the .NET languages are all
mutually compatible, they are clearly not. REAL compatibility would
mean you wouldn't even have to have such a thing as a VB project
separate from a C# project; you should simply be able to put them all
together in one happy project. Maybe that's for the Longhorn
release...?
1) Define an enumerator MyEnum in a VB project (VB_Proj_1).
2) Create a C# project C_Proj_2, with a reference to VB_Proj_1
3) Define an interface MyInterface in C_Proj_2, which has a method
referencing MyEnum:
void MyMethod(MyEnum x);
4) Create a new VB project VB_Proj_3, with references to both
VB_Proj_1 and C_Proj_2.
5) Create a class in VB_Proj_3 that implements MyInterface. Then,
using the VB smart editor, select the "MyInterface" interface on the
left drop-down, and "MyMethod" from the right drop-down, giving you
the automatically generated method header:
Public Sub MyMethod(ByVal x as MyEnum) Implements MyInterface.MyMethod
That should work, right? Sorry, no can do. You can move heaven and
earth, but you will not get the .NET compiler to accept any method
implementing MyInterface.MyMethod. It simply does not recognize the
MyEnum enumerator as being the same as that defined in the interface,
and you get the error message, "'MyMethod' cannot implement 'MyMethod'
because there is no matching sub on interface 'MyInterface'.
6) If, however, you shift the definition of MyEnum to another, new, C#
project, everything suddenly works fine & dandy.
For all Microsoft's marketing drivel that the .NET languages are all
mutually compatible, they are clearly not. REAL compatibility would
mean you wouldn't even have to have such a thing as a VB project
separate from a C# project; you should simply be able to put them all
together in one happy project. Maybe that's for the Longhorn
release...?