Created
March 14, 2020 13:18
-
-
Save tompazourek/7a4c60d46eab4cdfdcf3483a312c3d9a 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 static class NullableExtension | |
{ | |
public static bool TryGetValue<T>(this T? nullableValue, out T value) where T : struct | |
{ | |
if (!nullableValue.HasValue) | |
{ | |
value = default; | |
return false; | |
} | |
value = nullableValue.Value; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment