Example #1
0
 /// <summary>
 /// 获取转换器
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public IConvertor <T> Get <T>()
 => (IConvertor <T>)ConvertorProvider?.GetService(typeof(T))
 ?? ConvertorServices.Container?.GetConvertor <T>()
 ?? FailConvertor <T> .NotFound;
Example #2
0
 /// <summary>
 /// 获取转换器
 /// </summary>
 /// <param name="outputType"></param>
 /// <returns></returns>
 public IConvertor Get(Type outputType)
 => (IConvertor)ConvertorProvider?.GetService(outputType)
 ?? ConvertorServices.Container?.GetConvertor(outputType)
 ?? FailConvertor.NotFound;