private object GetService(object component, Type type) {
if (component == null) {
throw new ArgumentNullException("component");
}
if (component is IComponent)
{
ISite site = ((IComponent)component).Site;
if (site != null) {
return site.GetService(type);
}
}
return null;
}