/// <summary> /// Try to get IStringConverter /// </summary> /// <param name="converter"></param> /// <returns>true if found</returns> public bool TryGetConverter(Type type, out IStringConverter converter) { if (_items.ContainsKey(type) && _items[type] is IStringConverter c) { converter = c; return(true); } converter = StringConverterFactory.Empty(type); return(false); }
/// <summary> /// Try to get IStringConverter<T> /// </summary> /// <param name="converter"></param> /// <typeparam name="T"></typeparam> /// <returns>true if found</returns> public bool TryGetConverter <T>(out IStringConverter <T> converter) { var type = typeof(T); if (_items.ContainsKey(type) && _items[type] is IStringConverter <T> c) { converter = c; return(true); } converter = StringConverterFactory.Empty <T>(); return(false); }