Skip to content

Commit 55b8b09

Browse files
committed
Merge pull request #46 from JustinCreasy/master
Added support for string arrays in route values
2 parents 9316192 + b86cfe0 commit 55b8b09

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Griddly.Mvc/GriddlyExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Reflection;
@@ -169,7 +170,8 @@ public static string Current(this UrlHelper helper, object routeValues = null, b
169170
else if (t.HasCastOperator<DateTime>())
170171
// values[value.Key] = (DateTime)value.Value; -- BAD: can't unbox a value type as a different type
171172
values[value.Key] = Convert.ChangeType(value.Value, typeof(DateTime));
172-
173+
else if (t.IsArray || t.IsSubclassOf(typeof(IEnumerable)))
174+
values[value.Key] = string.Join(",", ((IEnumerable)value.Value).Cast<object>());
173175
}
174176
}
175177

0 commit comments

Comments
 (0)