G
Guest
Hi all
I wonder if the Microsoft C# compiler performs interface mapping according to the C# language specification (ECMA-334, 2nd edition December 2002)
Take a look at the following example
interface
int Foo { get; set;
class BaseClas
public int Fo
get { return 0;
set {
class DerivedClass: BaseClass,
public new int Fo
get { return 0;
Now let us locate the implementation for I.Foo. According to the language specification (section 20.4.2 Interface mapping), DerivedClass.Foo doesn't match I.Foo because DerivedClass.Foo doesn't have a set accessor. So the search for a matching implementation continues in BaseClass. Because BaseClass.Foo matches I.Foo, we are done
But to my surprise, running the compiler gives the following error
'DerivedClass' does not implement interface member 'I.Foo.set
(Note: if DerivedClass.Foo is removed, the program compiles without errors.
I've found other similar issues, but first I'd like to get your input on this one
Any comments would be greatly appreciated
Regards
pn
I wonder if the Microsoft C# compiler performs interface mapping according to the C# language specification (ECMA-334, 2nd edition December 2002)
Take a look at the following example
interface
int Foo { get; set;
class BaseClas
public int Fo
get { return 0;
set {
class DerivedClass: BaseClass,
public new int Fo
get { return 0;
Now let us locate the implementation for I.Foo. According to the language specification (section 20.4.2 Interface mapping), DerivedClass.Foo doesn't match I.Foo because DerivedClass.Foo doesn't have a set accessor. So the search for a matching implementation continues in BaseClass. Because BaseClass.Foo matches I.Foo, we are done
But to my surprise, running the compiler gives the following error
'DerivedClass' does not implement interface member 'I.Foo.set
(Note: if DerivedClass.Foo is removed, the program compiles without errors.
I've found other similar issues, but first I'd like to get your input on this one
Any comments would be greatly appreciated
Regards
pn