internal static NativeApiContainer UseStrategyOne(UnmanagedLibrary unmanagedLibrary, Type type, Strategy strat) { var ctx = new NativeApiContext(unmanagedLibrary, strat); return((NativeApiContainer)Activator.CreateInstance( (GetImplementationInDomain(type, AppDomain.CurrentDomain) ?? LibraryBuilder .CreateAssembly(BuilderOptions.GetDefault(type)) .GetTypes().FirstOrDefault(type.IsAssignableFrom)) ?? throw new InvalidOperationException("Failed to create type."), ctx)); }