Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ordinal comparisons #327

Merged
merged 1 commit into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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