Permalink
Browse files

Adding IsSubclassOf to check if we can use the object as a NameValueC…

…ollection in our attempt to convert into Expando.
  • Loading branch information...
1 parent 7415475 commit 44a393afbeeaab1e45627fe8669c54a6af7615da @hgarcia hgarcia committed Mar 25, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 Massive.cs
View
@@ -66,7 +66,7 @@ public static class ObjectExtensions {
var result = new ExpandoObject();
var d = result as IDictionary<string, object>; //work with the Expando as a Dictionary
if (o.GetType() == typeof(ExpandoObject)) return o; //shouldn't have to... but just in case
- if (o.GetType() == typeof(NameValueCollection)) {
+ if (o.GetType() == typeof(NameValueCollection) || o.GetType().IsSubclassOf(typeof(NameValueCollection)))
var nv = (NameValueCollection)o;
nv.Cast<string>().Select(key => new KeyValuePair<string, object>(key, nv[key])).ToList().ForEach(i => d.Add(i));
} else {

0 comments on commit 44a393a

Please sign in to comment.