Skip to content

Instantly share code, notes, and snippets.

@Yatekii
Created July 3, 2020 17:28
Show Gist options
  • Save Yatekii/cbb0ff85a760e4621205071289d664d7 to your computer and use it in GitHub Desktop.
Save Yatekii/cbb0ff85a760e4621205071289d664d7 to your computer and use it in GitHub Desktop.
if (first == "op")
{
Expression initialVar = OperationExpression;
// We have UI access at hand. Assemble the entire access chain.
foreach (var piece in pieces.Skip(1))
{
var number = -1;
try
{
number = int.Parse(piece);
initialVar = Expression.MakeIndex(initialVar, typeof(List<Object>).GetProperty("Item"), new[] { Expression.Constant(number) });
}
catch (FormatException)
{
initialVar = Expression.PropertyOrField(initialVar, piece);
}
}
return initialVar;
}
else
{
throw new Exception(String.Format("Unkown variable {0}", first));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment