Skip to content

Commit 91b5d4b

Browse files
committed
fix(typeExtensions): cast to IEnumerable using covariance
1 parent fa26049 commit 91b5d4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JsonApiDotNetCore/Extensions/TypeExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public static Type GetElementType(this IEnumerable enumerable)
3535
/// <summary>
3636
/// Creates a List{TInterface} where TInterface is the generic for type specified by t
3737
/// </summary>
38-
public static List<TInterface> GetEmptyCollection<TInterface>(this Type t)
38+
public static IEnumerable<TInterface> GetEmptyCollection<TInterface>(this Type t)
3939
{
4040
if (t == null) throw new ArgumentNullException(nameof(t));
4141

4242
var listType = typeof(List<>).MakeGenericType(t);
43-
var list = (List<TInterface>)Activator.CreateInstance(listType);
43+
var list = (IEnumerable<TInterface>)Activator.CreateInstance(listType);
4444
return list;
4545
}
4646

0 commit comments

Comments
 (0)