5

I was trying to do some mapping with a Simple.Data.SimpleRecord and tried to iterate through the members:

foreach (string memberName in Model.GetDynamicMemberNames())
{
    Console.Write Model.GetValueByMemberName(memberName); // or something
}

GetDynamicMemberNames() works fine - but I dont find a GetValueByMemberName(), Member[].Value or similar. It is a DynamicObject, so perhaps there's some built in method I'm missing.

PS I miss a SimpleData tag here. It's going to be big :-) https://github.com/markrendle/Simple.Data

casperOne
  • 73,706
  • 19
  • 184
  • 253
joeriks
  • 3,382
  • 8
  • 32
  • 42

1 Answers1

9

Ah - just cast it do a dictionary:

((IDictionary<string, object>)Model)["id"]

Case closed.

joeriks
  • 3,382
  • 8
  • 32
  • 42