static void SelectBackend() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type t in types) { if (t.GetInterface("IBackend") != null) { IBackend b = (IBackend)Activator.CreateInstance(t); if (!b.CanUse()) { Debug.Info("Unable to use backend " + t.Name); } else { backend = b; Debug.Info("Using backend " + t.Name); return; } } } Debug.Fatal("Unable to find suitable backend"); }