Update FindOpenGenericInterface to return the type itself if it is the interface
This commit is contained in:
Родитель
a66b155f3b
Коммит
7a02894b4a
|
@ -285,7 +285,14 @@ namespace Microsoft.Extensions.Configuration
|
|||
|
||||
private static Type FindOpenGenericInterface(Type expected, Type actual)
|
||||
{
|
||||
var interfaces = actual.GetTypeInfo().ImplementedInterfaces;
|
||||
var actualTypeInfo = actual.GetTypeInfo();
|
||||
if(actualTypeInfo.IsGenericType &&
|
||||
actual.GetGenericTypeDefinition() == expected)
|
||||
{
|
||||
return actual;
|
||||
}
|
||||
|
||||
var interfaces = actualTypeInfo.ImplementedInterfaces;
|
||||
foreach (var interfaceType in interfaces)
|
||||
{
|
||||
if (interfaceType.GetTypeInfo().IsGenericType &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче