Pass enum through methods
-
Hello everyone, I'm trying to make an questionnaire and I want to do this with enums. For example: enum Color{ Black, White } enum Height{ cm_10, cm_20 } With this information I want to show each enum in a panel, where you first have to answer the color and then the height, and it has to be extendable. But I don't get it working. Can you help me, I would like to do it something as following:
private void askQuestion(Enum e)
{
String[] ss = Enum.GetNames(typeof(e));
putOnScreen(ss);
}
private void overall()
{
ArrayList ar = new ArrayList();
ar.Add(Color);
ar.Add(Height);
foreach(Enum e in ar)
{
askQuestion(e);
}
}I guess it should be possible, but I don't know how.
-
Hello everyone, I'm trying to make an questionnaire and I want to do this with enums. For example: enum Color{ Black, White } enum Height{ cm_10, cm_20 } With this information I want to show each enum in a panel, where you first have to answer the color and then the height, and it has to be extendable. But I don't get it working. Can you help me, I would like to do it something as following:
private void askQuestion(Enum e)
{
String[] ss = Enum.GetNames(typeof(e));
putOnScreen(ss);
}
private void overall()
{
ArrayList ar = new ArrayList();
ar.Add(Color);
ar.Add(Height);
foreach(Enum e in ar)
{
askQuestion(e);
}
}I guess it should be possible, but I don't know how.
If you put your questions inside enumerations, you haven't got an extensible mechanism. When I've developed this type of application in the past, I've always used a database. Roughly, this breaks down into: Topics Questions Answers AnswerTypes (textbox, multi-select, etc) Scores for answer This makes for a much more extensible questionnaire application.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
If you put your questions inside enumerations, you haven't got an extensible mechanism. When I've developed this type of application in the past, I've always used a database. Roughly, this breaks down into: Topics Questions Answers AnswerTypes (textbox, multi-select, etc) Scores for answer This makes for a much more extensible questionnaire application.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
You are totaly right about that. I'm going to make it with a database. But if we asume that I would do it the way I described above (just to learn something), is this possible or possible but not done or something else?
It's possible - but not advisable. BTW - using ArrayList isn't a good idea. I assume you're not saddled with developing in .NET 1 or 1.1.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
It's possible - but not advisable. BTW - using ArrayList isn't a good idea. I assume you're not saddled with developing in .NET 1 or 1.1.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
-
You are totaly right about that. I'm going to make it with a database. But if we asume that I would do it the way I described above (just to learn something), is this possible or possible but not done or something else?
Or an XML file.