How to add a Global runtime service to System.ComponentModel.Container?
Suppose the .NET Component Model.
The Container class has GetService(Type service);
But I'm asking myself, how c开发者_如何学Pythonan I register Global Services accessible to all added Components
?
In order to do this you'll need to create a class that derives from Container
. The class Container
only supports service for the GetService
call and that's IContainer
. There is no way to extend this except for sub-typing and overriding the GetService method.
However this is only of very limited value as the method GetService
is protected. This means it's not usable by general components as they don't have access to this member.
精彩评论