List the dynamic members (and values) in Simple.Data.SimpleRecord

I tried to map to Simple.Data.SimpleRecord and tried to iterate through the members:

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

GetDynamicMemberNames () is working fine - but I do not find GetValueByMemberName (), Member []. Value or the like. This is DynamicObject, so maybe there is some kind of built-in method that I am missing.

PS I missed the SimpleData tag here. This will be great :-) https://github.com/markrendle/Simple.Data

+4
source share
1 answer

Ah - just drop it on the dictionary:

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

Case is closed.

+8
source

Source: https://habr.com/ru/post/1337303/


All Articles