Skip to content

Commit

Permalink
Merge pull request #327 from davkean/dev/davkean/Ordinal
Browse files Browse the repository at this point in the history
Use ordinal comparisons
  • Loading branch information
AArnott committed Jun 23, 2022
2 parents 0fcb0c1 + 3a5bd8c commit 8c08afe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private static bool IsPropertyRelated(MemberInfo member)
if (method != null)
{
return method.IsSpecialName
&& method.Name.StartsWith("get_");
&& method.Name.StartsWith("get_", StringComparison.Ordinal);
}

return false;
Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.VisualStudio.Composition/ExportFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static bool IsExportFactoryTypeV1(this Type type)
if (type != null && type.GetTypeInfo().IsGenericType)
{
var typeDefinition = type.GetGenericTypeDefinition();
if (typeDefinition.FullName?.StartsWith(ExportFactoryV1FullName) ?? false)
if (typeDefinition.FullName?.StartsWith(ExportFactoryV1FullName, StringComparison.Ordinal) ?? false)
{
return true;
}
Expand All @@ -43,7 +43,7 @@ internal static bool IsExportFactoryTypeV1(this TypeRef type)
int arity = type.GenericTypeParameterCount + type.GenericTypeArguments.Length;
if (arity > 0 && arity <= 2)
{
if (type.FullName?.StartsWith(ExportFactoryV1FullName) ?? false)
if (type.FullName?.StartsWith(ExportFactoryV1FullName, StringComparison.Ordinal) ?? false)
{
return true;
}
Expand All @@ -58,7 +58,7 @@ internal static bool IsExportFactoryTypeV2(this Type type)
if (type != null && type.GetTypeInfo().IsGenericType)
{
var typeDefinition = type.GetGenericTypeDefinition();
if (typeDefinition.FullName?.StartsWith(ExportFactoryV2FullName) ?? false)
if (typeDefinition.FullName?.StartsWith(ExportFactoryV2FullName, StringComparison.Ordinal) ?? false)
{
return true;
}
Expand All @@ -74,7 +74,7 @@ internal static bool IsExportFactoryTypeV2(this TypeRef type)
int arity = type.GenericTypeParameterCount + type.GenericTypeArguments.Length;
if (arity > 0 && arity <= 2)
{
if (type.FullName?.StartsWith(ExportFactoryV2FullName) ?? false)
if (type.FullName?.StartsWith(ExportFactoryV2FullName, StringComparison.Ordinal) ?? false)
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.VisualStudio.Composition/ExportProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ protected object GetStrongTypedMetadata(IReadOnlyDictionary<string, object?> met
if (method != null)
{
// If the method came from a property, return the result of the property getter rather than return the delegate.
if (method.IsSpecialName && method.GetParameters().Length == 0 && method.Name.StartsWith("get_"))
if (method.IsSpecialName && method.GetParameters().Length == 0 && method.Name.StartsWith("get_", StringComparison.Ordinal))
{
return method.Invoke(exportingPart, EmptyObjectArray);
}
Expand Down

0 comments on commit 8c08afe

Please sign in to comment.