public string Convert(object value) { if (value == null) { return("<null>"); } ConvertObjectToString convertor = GetVisitor(value.GetType()); return(convertor(value)); }
private ConvertObjectToString GetVisitor(Type type) { ConvertObjectToString convertor = handlerVisitors[type] as ConvertObjectToString; if (convertor == null) { return(toStringConverter); } else { return(convertor); } }
private void AddVisitor(Type type, ConvertObjectToString converter) { handlerVisitors.Add(type, converter); }