Skip to content

Commit 7063017

Browse files
authored
Use ArgumentNullException.ThrowIfNull when supported (#149)
1 parent 1c1ff56 commit 7063017

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/StronglyTypedIds.Templates/string-full.typedid

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414

1515
public PLACEHOLDERID(string value)
1616
{
17+
#if NET7_0_OR_GREATER
18+
global::System.ArgumentNullException.ThrowIfNull(value);
19+
Value = value;
20+
#else
1721
Value = value ?? throw new global::System.ArgumentNullException(nameof(value));
22+
#endif
1823
}
1924

2025
public static readonly PLACEHOLDERID Empty = new PLACEHOLDERID(string.Empty);

src/StronglyTypedIds/EmbeddedSources.String.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ partial struct PLACEHOLDERID :
1616
1717
public PLACEHOLDERID(string value)
1818
{
19+
#if NET7_0_OR_GREATER
20+
global::System.ArgumentNullException.ThrowIfNull(value);
21+
Value = value;
22+
#else
1923
Value = value ?? throw new global::System.ArgumentNullException(nameof(value));
24+
#endif
2025
}
2126
2227
public static readonly PLACEHOLDERID Empty = new PLACEHOLDERID(string.Empty);

0 commit comments

Comments
 (0)