I have a MessageProcessor class which processes xml messages of different types. A switch statement (C#) based on the message type calls the appropriate method to parse the xml and extract the data required for the type of message.
I would rather have a number of parser classes, one of which will be injected into the MessageProcessor when it is created based on the message type. Switch replaced with polymorphism - so far so good.
However, the problem I have is that the current parser methods each return different results, e.g. ParseExecute(xml, out Session), ParseCallback(xml, out id, out name, ...)
Is it possible to do what I want to do in this scenario?