public static object?ConvertTo(this ISsslConverter converter, SsslObject ssslObject, Type type) { if (converter is null) { throw new ArgumentNullException(nameof(converter)); } return(converter.TryConvertTo(ssslObject, type, out var result) ? result : throw new InvalidCastException()); }
public static bool TryConvertTo <T>(this ISsslConverter converter, SsslObject ssslObject, [MaybeNull] out T result) { if (converter is null) { throw new ArgumentNullException(nameof(converter)); } if (converter.TryConvertTo(ssslObject, typeof(T), out var obj)) { result = (T)obj !; return(true); } result = default !;