-
Hello, using Reflection seems to be quite different in the nanoFramework. Lets say I have a class Configuration with properties that are classes with properties: `
` I could get all settings with its values with something like this: `
Result: HtmlTitle: Configuration Setting1: TestLoopFieldInfo.Setting1 Setting2: TestLoopFieldInfo.Setting2 Setting3: TestLoopFieldInfo.Setting3 ` But how can I do this in the nanoFramework? I do not have the possibility to call the properties like this ` var propertiesOuter = configuration.GetType().GetProperties(); ` The "Reflection" samples sadly does not contain the information I am looking for - I think. Thank you in advance for your answers! Regards. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
.NET nanoFramework reflection API is as close as possible to the full framework. |
Beta Was this translation helpful? Give feedback.
-
Hey guys, I have the feeling that you both feel attacked in any way because of my words?! "josesimoes" you did not really answer but wrote more something like a justification. But you really do not need to, I like your work very much. English is not my mother language so please forgive me using not the right words. My problem may be that Reflection is not my hobbyhorse. I found a solution in my desktop app (published above), but I seem to be at the beginning again here and sadly with nearly no progress. I started with
But I do not know how to get the properties of the Setting1, Setting2, Setting3 and how to get the values. When I started this discussion I hoped that you could show me the right direction, that you could help me with that a little bit. Thanks again. |
Beta Was this translation helpful? Give feedback.
I have something that generates automatically web pages for configurations. The code is here: https://github.com/Ellerbach/LegoTrain/blob/main/SharedServices/Controllers/ConfigurationController.cs
It's fully using reflection, you just need to have the configuration class being based on a common interface which can be totally empty if you want. As you'll see in the code, it will find all the methods, the associated types and generate the proper control. Special case for bools as in javascript in the forms, you have to keep the state. It does also with convention supports things like password depending on your naming conventions.