lambda2js icon indicating copy to clipboard operation
lambda2js copied to clipboard

Support for List, Nested Object and Dictionary property initializers

Open jonstelly opened this issue 4 years ago • 0 comments

This enhances MemberInitAsJson to support nested objects, lists, and dictionaries. Dictionary initializers aren't supported in Linq Expression Trees, so this supports a workaround format using the generic dictionary constructor that takes an IEnumerable<KVP> argument, so:

Dictionary = new Dictionary<string, object>(new[]{
  new KeyValuePair<string, object>("One", 1),
  new KeyValuePair<string, object>("Two", 2)
})

Also added a few unit tests to validate and demonstrate supported expression formats.

jonstelly avatar Jun 22 '20 19:06 jonstelly