I'm trying to write an xml parser to take some data in a game and build out objects for me. Right now I want to go through the nodes and build out different config objects based on the node/attributes.
foreach (XmlNode node in actionList) {
ActionConfig config;
if (some checks determine action is "Fire") {
config = new FireActionConfig();
config.speed = (float)node.Attributes["speed"].Value;
}
// do something with config
}
The error I get is "ActionConfig does not contain a definition for speed...". I tried casting config as FireActionConfig even though it's already defined as one.