public bool HasStaticHandler <T>(Supports <T> capability) where T : DynamicCapability, ConnectedCapability <IJsonRpcHandler> { if (!capability.IsSupported) { return(false); } if (capability.Value == null) { return(false); } if (capability.Value.DynamicRegistration) { return(false); } var handlerType = typeof(T).GetTypeInfo().ImplementedInterfaces .Single(x => x.GetTypeInfo().IsGenericType&& x.GetTypeInfo().GetGenericTypeDefinition() == typeof(ConnectedCapability <>)) .GetTypeInfo().GetGenericArguments()[0].GetTypeInfo(); return(!capability.Value.DynamicRegistration && _collection.Any(z => z.HandlerType.GetTypeInfo().IsAssignableFrom(handlerType) || z.Handler.GetType().GetTypeInfo().IsAssignableFrom(handlerType))); }