Calling protected method from interface that doesn't include method

  • Thread starter Thread starter Jon Shemitz
  • Start date Start date
J

Jon Shemitz

I'm puzzled by this, code clarified from working code

IToolboxService GetToolboxService(IDesignerHost AnyDesigner)
{
return (IToolboxService)
AnyDesigner.RootComponent.Site.
GetService( typeof(IToolboxService) );
}

Now, RootComponent is an IComponent, and Site is an ISite. Which
brings me to my question: ISite does not have a GetService method.
Components and Containers have a protected GetService method.

I appear to be calling a protected method of an object that I
supposedly only know of through an interface that doesn't include this
method?
 
Jon,
Now, RootComponent is an IComponent, and Site is an ISite. Which
brings me to my question: ISite does not have a GetService method.

ISite derives from IServiceProvider, which has the GetService method.



Mattias
 
Mattias Sjögren said:
ISite derives from IServiceProvider, which has the GetService method.

I had second thoughts in the night, when I couldn't sleep. Came in,
booted up, found this with F12. Was going to retract.

Thanks! though.
 
Back
Top