Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,30 @@ private void WriteArray(object o, object? choiceSource, ElementAccessor[] elemen

private void WriteArrayItems(ElementAccessor[] elements, TextAccessor? text, ChoiceIdentifierAccessor? choice, object o, object? choiceSources)
{
Array? choiceArray = choiceSources as Array;

if (o is Array array)
{
IEnumerator e = array.GetEnumerator();
int c = 0;
while (e.MoveNext())
{
object ai = e.Current;
object? choiceSource = choiceArray?.GetValue(c++);
WriteElements(ai, choiceSource, elements, text, choice, true, true);
}

return;
}

var arr = o as IList;

if (arr != null)
{
for (int i = 0; i < arr.Count; i++)
{
object? ai = arr[i];
var choiceSource = ((Array?)choiceSources)?.GetValue(i);
object? choiceSource = choiceArray?.GetValue(i);
WriteElements(ai, choiceSource, elements, text, choice, true, true);
}
}
Expand All @@ -175,7 +191,7 @@ private void WriteArrayItems(ElementAccessor[] elements, TextAccessor? text, Cho
while (e.MoveNext())
{
object ai = e.Current;
var choiceSource = ((Array?)choiceSources)?.GetValue(c++);
object? choiceSource = choiceArray?.GetValue(c++);
WriteElements(ai, choiceSource, elements, text, choice, true, true);
}
}
Expand Down