Skip to content

Commit 3b1bbe9

Browse files
committed
Refactor plugin loading LINQ to fluent chain
1 parent dccdc16 commit 3b1bbe9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

QuickLook/PluginManager.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ private void LoadPlugins(string folder)
9292
{
9393
try
9494
{
95-
(from t in Assembly.LoadFrom(lib).GetExportedTypes()
96-
where !t.IsInterface && !t.IsAbstract
97-
where typeof(IViewer).IsAssignableFrom(t)
98-
select t).ToList()
99-
.ForEach(type => LoadedPlugins.Add(type.CreateInstance<IViewer>()));
95+
Assembly.LoadFrom(lib)
96+
.GetExportedTypes()
97+
.Where(t => !t.IsInterface && !t.IsAbstract
98+
&& typeof(IViewer).IsAssignableFrom(t))
99+
.ToArray()
100+
.ForEach(t => LoadedPlugins.Add(t.CreateInstance<IViewer>()));
100101
}
101102
// 0x80131515: ERROR_ASSEMBLY_FILE_BLOCKED - Windows blocked the assembly due to security policy
102103
catch (FileLoadException ex) when (ex.HResult == unchecked((int)0x80131515) && SettingHelper.IsPortableVersion())

0 commit comments

Comments
 (0)