Calling protected method from interface that doesn't include method

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?
 
M

Mattias Sjögren

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
 
J

Jon Shemitz

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top