public static bool TryTypeAssert <T>(this main_package.I target, out T result) { try { result = target.TypeAssert <T>(); return(true); } catch (PanicException) { result = default !;
public static ref T TypeAssert <T>(this main_package.I target) { try { return(ref ((main_package.I <T>)target).Target); } catch (NotImplementedException ex) { throw new PanicException($"panic: interface conversion: {target.GetType().FullName} is not {typeof(T).FullName}: missing method {ex.InnerException?.Message}"); } }