Created
May 8, 2020 21:19
-
-
Save enisn/5b3740c1a91572ee99b1107d35ec2373 to your computer and use it in GitHub Desktop.
NullChecks - Sample 3
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 class NotNull<T> | |
{ | |
public NotNull(T value) | |
{ | |
this.Value = value; | |
} | |
public T Value { get; set; } | |
public static implicit operator NotNull<T>(T value) | |
{ | |
if (value == null) | |
throw new ArgumentNullException(); | |
return new NotNull<T>(value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment