Permalink
Browse files

Added Casting

Method allows casting from dynamic to a concrete object
  • Loading branch information...
1 parent 53ca28b commit d0b02fc834b02106f1fdea66ae3006bbe7c03530 @asharzaman asharzaman committed Oct 11, 2012
Showing with 4 additions and 6 deletions.
  1. +4 −6 Massive.cs
View
@@ -27,14 +27,12 @@ public static class ObjectExtensions {
var list = new List<T>(expandos.Count());
var props = typeof(T).GetProperties();
-
+
+ IDictionary<string, object> kv = null;
+ //need to iterate and Convert to Dictionary
foreach (var expando in expandos) {
var obj = Activator.CreateInstance<T>();
- if (expando.GetType() != typeof(ExpandoObject)) {
- // not an expando object - continue to the next one in the list
- continue;
- }
- var kv = ((IDictionary<string, object>)expando);
+ kv = ((object)expando).ToDictionary();
foreach (var p in props) {
if (kv.ContainsKey(p.Name)) {

0 comments on commit d0b02fc

Please sign in to comment.