Skip to content

Commit ade1c64

Browse files
committed
CsvOutputFormatter now accepts to process any IEnumerable instead of limiting to IList
1 parent 1e486f4 commit ade1c64

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/WebApiContrib.Core.Formatter.Csv/CsvOutputFormatter.cs

+4-9
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,10 @@ protected override bool CanWriteType(Type type)
4343

4444
private bool IsTypeOfIEnumerable(Type type)
4545
{
46-
47-
foreach (Type interfaceType in type.GetInterfaces())
48-
{
49-
50-
if (interfaceType == typeof(IList))
51-
return true;
52-
}
53-
54-
return false;
46+
if (type == null)
47+
throw new ArgumentNullException("type");
48+
49+
return typeof(IEnumerable).IsAssignableFrom(type);
5550
}
5651

5752
/// <summary>

0 commit comments

Comments
 (0)