Esempio n. 1
0
 public static ArgumentUtilitiesHandle <TTo> Cast <TFrom, TTo>(this ArgumentUtilitiesHandle <TFrom> hnd)
 {
     try {
         return(hnd.AsChanged(value: hnd.Value.Cast <TFrom, TTo>()));
     } catch (Exception exception) {
         throw
             new ArgumentException(
                 message: $"{FormatXResource(typeof(ArgumentException), "InvalidType/IncompatibleWithT", hnd.Value?.GetType() ?? typeof(TFrom), typeof(TTo))}{Environment.NewLine}Имя параметра: '{hnd.Name}'.",
                 innerException: exception);
     }
 }