Skip to content

Commit 07d1db1

Browse files
committed
Use Ordinal Comparisons instead of culture-specific in string IDs
1 parent 33eafad commit 07d1db1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/StronglyTypedIds.Templates/nullablestring-full.typedid

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(null, null) => true,
2727
(null, _) => false,
2828
(_, null) => false,
29-
(_, _) => Value.Equals(other.Value),
29+
(_, _) => Value.Equals(other.Value, global::System.StringComparison.Ordinal),
3030
};
3131

3232
public override bool Equals(object? obj)
@@ -49,7 +49,7 @@
4949
(null, null) => 0,
5050
(null, _) => -1,
5151
(_, null) => 1,
52-
(_, _) => Value.CompareTo(other.Value),
52+
(_, _) => string.CompareOrdinal(Value, other.Value),
5353
};
5454

5555
public class PLACEHOLDERIDTypeConverter : global::System.ComponentModel.TypeConverter

src/StronglyTypedIds.Templates/string-full.typedid

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
(null, null) => true,
2727
(null, _) => false,
2828
(_, null) => false,
29-
(_, _) => Value.Equals(other.Value),
29+
(_, _) => Value.Equals(other.Value, global::System.StringComparison.Ordinal),
3030
};
3131

3232
public override bool Equals(object? obj)
@@ -49,7 +49,7 @@
4949
(null, null) => 0,
5050
(null, _) => -1,
5151
(_, null) => 1,
52-
(_, _) => Value.CompareTo(other.Value),
52+
(_, _) => string.CompareOrdinal(Value, other.Value),
5353
};
5454

5555
public class PLACEHOLDERIDTypeConverter : global::System.ComponentModel.TypeConverter

src/StronglyTypedIds/EmbeddedSources.String.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public bool Equals(PLACEHOLDERID other)
2828
(null, null) => true,
2929
(null, _) => false,
3030
(_, null) => false,
31-
(_, _) => Value.Equals(other.Value),
31+
(_, _) => Value.Equals(other.Value, global::System.StringComparison.Ordinal),
3232
};
3333
3434
public override bool Equals(object? obj)
@@ -51,7 +51,7 @@ public int CompareTo(PLACEHOLDERID other)
5151
(null, null) => 0,
5252
(null, _) => -1,
5353
(_, null) => 1,
54-
(_, _) => Value.CompareTo(other.Value),
54+
(_, _) => string.CompareOrdinal(Value, other.Value),
5555
};
5656
5757
public class PLACEHOLDERIDTypeConverter : global::System.ComponentModel.TypeConverter

0 commit comments

Comments
 (0)