Skip to content

Question about using Reflection #1609

Closed Answered by Ellerbach
Tjossul asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
1 reply
@Ellerbach
Comment options

Comment options

You must be logged in to vote
7 replies
@Tjossul
Comment options

@networkfusion
Comment options

@Tjossul
Comment options

@Ellerbach
Comment options

Answer selected by Tjossul
@Tjossul
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants