How to compare two instances of AssemblyName?

How to compare two instances of AssemblyName to find out if they represent the same assembly? The Equals method is not reevaluated.

One way I can think of is to compare the "ToString ()" results of both instances, but I would prefer the "Equals" syntax, since I need to prepare a (List) of "unique" instances of AssemblyName and would like to use the method "Contains (AssemblyName item)."

+5
source share
2 answers

As long as you use strongly-named assemblies, a comparison of the output of a method that should be consistent and apparently culturally invariant .

If the assemblies do not have a strong name, then you can easily create another assembly with the same name and version number / culture, and it will have the same assembly name as yours.

One thing to note because assembly names are the same does not mean that assemblies have the same physical identity; location is not part of the assembly name.

+6
source

I would compare the property AssemblyName.FullName, since it represents the actual specific version of the assembly of the assembly.

+2
source

All Articles