Is it possible to create a property in C# that has a variable number of sub properties and then generate them via xml? Example below
Question.Name = "cake";
Question.Type = "radio";
foreach(Option option in xmloptions)
{
Question...........
}
So what I am getting at is if xmloptions had 5 options on one question then 4 on the next. Could I populate those as such in the property I create to house the questions? And if so how can I enumerate them?
Forgive me if that makes no sense……
I think that one of the properties of your
Questionclass should be either a list or a dictionary:and then you add the options with:
If each option is identified by something – like a name for example – you can use a dictionary:
and in this case you add the options with: