There is some discussion of this in ECMA 334, 20.4.1 It is a compile-time error for an explicit interface member implementation to include any modifiers other than extern (§17.5). It is a compile-time error for an explicit interface method implementation to include type-parameter-constraints-clauses. The constraints for a generic explicit interface method implementation are inherited from the interface method.
Explicit interface member implementations have different accessibility characteristics than other members. Because explicit interface member implementations are never accessible through a qualified interface member name in a method invocation or a property access, they are in a sense private. However, since they can be accessed through an interface instance, they are in a sense also public. If you go look at the SSCLI this makes more sense as you can see how interfaces vs virtual members work with lookups ... Cheers, Greg On Wed, Mar 12, 2008 at 11:38 AM, Simon Robinson <[EMAIL PROTECTED]> wrote: > This code won't compile: > > interface ITest > { > bool Foo(); > } > > public class Base : ITest > { > virtual bool ITest.Foo() { return true; } > } > > The compiler objects to making ITest.Foo() virtual - it seems that for > some reason C# won't allow an interface member to be virtual or abstract > if it's been implemented explicitly (although if I don't implement it > explicitly, the compiler is quite happy with the virtual/abstract > modifier). Anyone know what the rationale for such a restriction would be? > Offhand I can't see why doing that should be problematic. > > =================================== > This list is hosted by DevelopMentor(R) http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > -- Studying for the Turing test =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com