Skip to content

Commit 3fe0a7b

Browse files
authored
Merge pull request #155 from mlucchini/master
CsvOutputFormatter now accepts IEnumerable
2 parents 1e486f4 + ade1c64 commit 3fe0a7b

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)