private Type GetTypeCore(string typeName) { #if SILVERLIGHT Assembly a = typeof(System.Action).Assembly; Type type = a.GetType(typeName, false); if (type != null) return type; foreach (System.Windows.AssemblyPart ap in System.Windows.Deployment.Current.Parts) { System.Windows.Resources.StreamResourceInfo sri = System.Windows.Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative)); Assembly assembly = new System.Windows.AssemblyPart().Load(sri.Stream); type = assembly.GetType(typeName, false); if (type != null) return type; } #else // First - try all loaded types foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { Type type = assembly.GetType(typeName, false, true); if (type != null) return type; } #endif return type; }