This seems like a reasonable (and maybe simple?) scenario, but how would you do the following:
Lets say I have 2 interfaces:
Interface ISimpleInterface string ErrorMsg { get; } End Interface Interface IExtendedInterface string ErrorMsg { get; set; } string SomeOtherProperty { get; set; } End Interface
I want a class to implement both interfaces:
Public Class Foo Implements ISimpleInterface, IExtendedInterface
How do I define the ErrorMsg property in the class given that each interface has a different access level?
Here is my scenario in case you are wondering: I am writing a UserControl using a psuedo MVC arhitecture, where the UserControl exposes the extended interface to it’s Controller, and exposes the Simple interface to the Consumers of the control.
By the way, implementing this in VB.NET (any suggested synatx in vb would be appreciated).
You can implement one of them or both interfaces with an ‘explicit interface’ implementation, so the compiler knows which ErrorMsg property belongs to which interface.
To do this simply write :ISimpleInterface (for C#) after your class name and then click on ISimpleInterface and select implement explicit interface.
More information here: http://msdn.microsoft.com/en-us/library/aa288461(VS.71).aspx