kamagra how much to take

Determine Referenced Assemblies and Assembly Load State

I find this approach really helpful when I am building assembly self-analysis into packages to ensure shared component load state, as well as being helpful when maintain audit logs of referenced assemblies in a SharePoint environment.

To do this, you can use the below three methods.

CompareLeftAndRightAssembly simply consumes two AssemblyName objects, doing a simple string comparison to see if the AssemblyName.FullName property is equitable. The FindAllTheReferencedAssemblies method takes an ArrayList representing the loaded assemblies using the GetReferencedAssemblies method to have a collection to iterate against. Inherently, this method uses the IsTheAssemblyLoaded method which will use the previously discussed CompareLeftAndRightAssembly method.

public static bool CompareLeftAndRightAssembly(AssemblyName asmLeft, AssemblyName asmRight)
{
return (((asmLeft == null) && (asmRight == null)) ||
(((asmLeft != null) && (asmRight != null)) &&
(Equals(string.Compare(asmLeft.FullName, asmRight.FullName, StringComparison.Ordinal), 0))));
}

public static void FindAllTheReferencedAssemblies(ArrayList loadedAssemblies)
{
var flag = false;
while (!flag)
{
flag = true;
for (var i = 0; i < loadedAssemblies.Count; i++) { var referencedAssemblies = ((Assembly)loadedAssemblies[i]).GetReferencedAssemblies(); for (var j = 0; j < referencedAssemblies.Length; j++) { if (IsTheAssemblyLoaded(loadedAssemblies, referencedAssemblies[j])) continue; flag = false; loadedAssemblies.Add(Assembly.Load(referencedAssemblies[j])); } } } } public static bool IsTheAssemblyLoaded(ArrayList loaded, AssemblyName name) { if (loaded != null) { for (var i = 0; i < loaded.Count; i++) { if (CompareLeftAndRightAssembly(((Assembly)loaded[i]).GetName(), name)) { return true; } } } return false; } [/csharp]

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>