Created
January 13, 2022 18:25
-
-
Save rdelrosario/c8e5947c65ca788c77a2df882381ff34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class User | |
{ | |
public User(string firstName) | |
{ | |
if (firstName == null) | |
throw new ArgumentNullException(nameof(firstName), "First name cannot be null."); | |
if (firstName.Length == 0) | |
throw new ArgumentException("First name cannot be empty.", nameof(firstName)); | |
if (firstName.Length > 20) | |
throw new ArgumentException("First name Length cannot has more than 20 characters.", nameof(firstName)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment