Skip to content

Commit

Permalink
Allowed empty cells for non-enum array types.
Browse files Browse the repository at this point in the history
  • Loading branch information
zzxiang committed May 4, 2018
1 parent 4f092d5 commit 8b6de5c
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,19 @@ public T Deserialize(ListEntry e) {
char[] charToTrim = { ',', ' ' };
str = str.TrimEnd(charToTrim);

// split by ','
object[] temp = str.Split(DELIMETER);
if (!string.IsNullOrEmpty(str)) {
// split by ','
object[] temp = str.Split(DELIMETER);

Array array = (Array)Activator.CreateInstance(property.PropertyType, temp.Length);
Array array = (Array)Activator.CreateInstance(property.PropertyType, temp.Length);

for (int i = 0; i < array.Length; i++)
{
array.SetValue(Convert.ChangeType(temp[i], property.PropertyType.GetElementType()), i);
}
for (int i = 0; i < array.Length; i++)
{
array.SetValue(Convert.ChangeType(temp[i], property.PropertyType.GetElementType()), i);
}

property.SetValue(r, array, null);
property.SetValue(r, array, null);
}
}
}
else
Expand Down

0 comments on commit 8b6de5c

Please sign in to comment.