@@ -580,7 +580,8 @@ public static void SetPropertyValues(object obj,bool onlyPopulateListEditorLists
580
580
581
581
var subObject = Activator . CreateInstance ( propType ) ;
582
582
583
- if ( propType . IsGenericType /*&&
583
+ if ( propType . IsGenericType && propType . GetGenericArguments ( ) . Length == 1
584
+ /*&&
584
585
propType.GetGenericTypeDefinition()
585
586
== typeof(IList<>)*/ )
586
587
{
@@ -594,11 +595,11 @@ public static void SetPropertyValues(object obj,bool onlyPopulateListEditorLists
594
595
{
595
596
listItem = ( Single ? ) 0f ;
596
597
}
597
- else if ( itemType == typeof ( Char ? ) )
598
+ else if ( itemType == typeof ( Char ? ) )
598
599
{
599
600
listItem = ( Char ? ) ' ' ;
600
601
}
601
- else if ( itemType == typeof ( Decimal ? ) )
602
+ else if ( itemType == typeof ( Decimal ? ) )
602
603
{
603
604
listItem = ( Decimal ? ) 0m ;
604
605
}
@@ -625,13 +626,18 @@ public static void SetPropertyValues(object obj,bool onlyPopulateListEditorLists
625
626
else
626
627
listItem = Activator . CreateInstance ( itemType ) ;
627
628
subObject . GetType ( ) . GetMethod ( "Add" ) . Invoke ( subObject , new [ ] { listItem } ) ;
628
- if ( depth < SetPropertyValuesMaxDepth && listItem != null )
629
- SetPropertyValues ( listItem , onlyPopulateListEditorLists : onlyPopulateListEditorLists , depth : depth + 1 , setNullableFields : setNullableFields ) ;
629
+ if ( depth < SetPropertyValuesMaxDepth && listItem != null )
630
+ SetPropertyValues ( listItem , onlyPopulateListEditorLists : onlyPopulateListEditorLists , depth : depth + 1 , setNullableFields : setNullableFields ) ;
630
631
}
631
632
property . SetValue ( obj , subObject , null ) ;
632
633
}
633
-
634
-
634
+ else if ( propType . GetGenericArguments ( ) . Length > 1 ) {
635
+ if ( propType . GetGenericArguments ( ) . Length == 2 ) {
636
+ //likely a dictionary
637
+ Type keyType = propType . GetGenericArguments ( ) [ 0 ] ;
638
+ //TODO, handle dictionaries
639
+ }
640
+ }
635
641
}
636
642
else
637
643
if ( property . PropertyType . IsClass && property . PropertyType != typeof ( string ) )
0 commit comments