Skip to content

Commit

Permalink
Use ArgumentNullException.ThrowIfNull when supported (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma authored Oct 2, 2024
1 parent 1c1ff56 commit 7063017
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/StronglyTypedIds.Templates/string-full.typedid
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@

public PLACEHOLDERID(string value)
{
#if NET7_0_OR_GREATER
global::System.ArgumentNullException.ThrowIfNull(value);
Value = value;
#else
Value = value ?? throw new global::System.ArgumentNullException(nameof(value));
#endif
}

public static readonly PLACEHOLDERID Empty = new PLACEHOLDERID(string.Empty);
Expand Down
5 changes: 5 additions & 0 deletions src/StronglyTypedIds/EmbeddedSources.String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ partial struct PLACEHOLDERID :

public PLACEHOLDERID(string value)
{
#if NET7_0_OR_GREATER
global::System.ArgumentNullException.ThrowIfNull(value);
Value = value;
#else
Value = value ?? throw new global::System.ArgumentNullException(nameof(value));
#endif
}

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

0 comments on commit 7063017

Please sign in to comment.