Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
hotfix array deserialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
didimitrie committed Mar 12, 2018
1 parent 380d731 commit fcfffa8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions SpeckleCore/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,18 @@ public static object Deserialise( SpeckleObject obj, object root = null )
{
try
{
var mySubList = Activator.CreateInstance( prop != null ? prop.PropertyType : field.FieldType );
foreach ( var myObj in ( ( IEnumerable<object> ) value ) )
mySubList.GetType().GetMethod( "Add" ).Invoke( mySubList, new object[ ] { myObj } );
if ( prop.PropertyType.IsArray || field.FieldType.IsArray )
{
value = ( ( List<object> ) value ).ToArray();
}
else
{
var mySubList = Activator.CreateInstance( prop != null ? prop.PropertyType : field.FieldType );
foreach ( var myObj in ( ( IEnumerable<object> ) value ) )
mySubList.GetType().GetMethod( "Add" ).Invoke( mySubList, new object[ ] { myObj } );

value = mySubList;
value = mySubList;
}
}
catch { }
}
Expand Down

0 comments on commit fcfffa8

Please sign in to comment.