V
Verde
Is there an easier way to determine if a specific assembly is loaded into
the current AppDomain?
I'm thinking that there has to be a way to do it without looping through all
currently loaded assemblies, yet I couldn't find how to do it without
looping.
This is what I have:
private bool AssemblyIsLoaded(string pathToAssembly)
{
foreach (Assembly currentAssembly in
AppDomain.CurrentDomain.GetAssemblies())
{
try // This try/catch block is necessary because the .Location
property is not supported in a dynamic assembly.
{
if (currentAssembly.Location.Equals(pathToAssembly,
StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
catch (Exception ex) { }
}
return false;
}
Thanks in advance.
the current AppDomain?
I'm thinking that there has to be a way to do it without looping through all
currently loaded assemblies, yet I couldn't find how to do it without
looping.
This is what I have:
private bool AssemblyIsLoaded(string pathToAssembly)
{
foreach (Assembly currentAssembly in
AppDomain.CurrentDomain.GetAssemblies())
{
try // This try/catch block is necessary because the .Location
property is not supported in a dynamic assembly.
{
if (currentAssembly.Location.Equals(pathToAssembly,
StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
catch (Exception ex) { }
}
return false;
}
Thanks in advance.