7
我目前正試圖將Xamarin.iOS應用程序庫轉換爲PCL(配置文件78)。我有這樣的代碼,將不能編譯:便攜式類庫反射
public static void RegisterAllCommandHandlers(IEnumerable<Assembly> assemblies) {
// Get all types that are concrete classes which implement ICommandHandler
var commandHandlerOpenGenericType = typeof(ICommandHandler<>);
var types = new List<Type>();
foreach (var assembly in assemblies) {
types.AddRange(assembly.GetTypes()
.Where(x => x.IsClass && !x.IsAbstract && x.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == commandHandlerOpenGenericType)));
}
}
以下是編譯器錯誤的圖像:
我如何做同樣的事情用新的反射API?
你在你的PCL指定哪些平臺? – Markus
@Markus Profile 78(Xamarin.IOS,Xamarin.Android,.net 4.5,windows store,windows phone 8 –
你得到的編譯器錯誤是什麼?(該圖不顯示編譯器錯誤) – elgonzo