[Mono-dev] A possible implementation for AssemblyName.ReferenceMatchesDefinition
Stifu
stifu at free.fr
Tue Aug 27 16:53:41 UTC 2013
If I'm not mistaken, the last 2 tests are redundant. You're basically doing
the same test twice.
So I guess this could be simplified to something like:
public static bool ReferenceMatchesDefinition (AssemblyName reference,
AssemblyName definition)
{
if (reference == null)
throw new ArgumentNullException ("reference");
if (definition == null)
throw new ArgumentNullException ("definition");
return reference.Name == definition.Name;
}
mlgo wrote
> According to
> http://msdn.microsoft.com/en-us/library/system.reflection.assemblyname.referencematchesdefinition.aspx
>
> The following is what is expected to be returned from
> ReferenceMatchesDefinition.
>
> Returns a value indicating whether two assembly names are the same. The
> comparison is based on the simple assembly names.
>
> This seems naïve but below is a tentative implementation of that. Any
> ideas?
>
> public static bool ReferenceMatchesDefinition (AssemblyName reference,
> AssemblyName definition)
> {
> if (reference == null)
> throw new ArgumentNullException ("reference");
> if (definition == null)
> throw new ArgumentNullException ("definition");
> if (reference.Name != definition.Name)
> return false;
>
> return reference.Name.Equals(definition.Name);
> }
--
View this message in context: http://mono.1490590.n4.nabble.com/A-possible-implementation-for-AssemblyName-ReferenceMatchesDefinition-tp4660683p4660686.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list