[Mono-dev] A possible implementation for AssemblyName.ReferenceMatchesDefinition

Daniel Lo Nigro lists at dan.cx
Wed Aug 28 00:18:10 UTC 2013


You may want to ignore culture and case in your comparison:

return reference.Name.Equals(definition.Name,
StringComparison.InvariantCultureIgnoreCase)



On Wed, Aug 28, 2013 at 1:29 AM, mlgo <mlintner at sinenomine.net> 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-tp4660683.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130828/6abeffc7/attachment.html>


More information about the Mono-devel-list mailing list