I have the following class
public class CVisitor : IVisitor { public int Visit(Heartbeat element) { Trace.WriteLine("Heartbeat"); return 1; } public int Visit(Information element) { Trace.WriteLine("Information"); return 1; } }
I want to have a dictionary with mappings that each type of argument will be mapped to its implementation function: Heartbeat will map to public int Visit(Heartbeat element)
I thought of doing something like the following:
_messageMapper = new Dictionary<Type, "what should be here ?" >(); _messageMapper.Add(typeof(Heartbeat), "and how I put it here?" );
what should I put instead of "what should be here?" and "and how did I say that?"
thanks
Night walker
source share