Skip to content

Commit 2a95ebd

Browse files
committed
Use StartsWith(char value) for modern TFM
1 parent d4c4eb5 commit 2a95ebd

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Src/FluentAssertions/CallerIdentifier.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private static bool StartsWithNewKeyword(string candidate)
243243

244244
private static bool IsStringLiteral(string candidate)
245245
{
246-
return candidate.StartsWith("\"", StringComparison.Ordinal);
246+
return candidate.StartsWith('\"');
247247
}
248248

249249
private static bool IsNumeric(string candidate)

Src/FluentAssertions/Common/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static string Combine(this string @this, string other, string separator =
8888
return @this;
8989
}
9090

91-
if (other.StartsWith("[", StringComparison.Ordinal))
91+
if (other.StartsWith('['))
9292
{
9393
separator = string.Empty;
9494
}

Src/FluentAssertions/SystemExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ public static bool Contains(this string str, string value, StringComparison comp
1616

1717
public static bool Contains(this string str, char value, StringComparison comparison) =>
1818
str.IndexOf(value, comparison) != -1;
19+
20+
// https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs,1014
21+
public static bool StartsWith(this string str, char value) =>
22+
str.Length != 0 && str[0] == value;
1923
}

0 commit comments

Comments
 (0)