Created
April 20, 2022 07:30
-
-
Save savaged/4612cafbfa651d80020adf6d658b0cda to your computer and use it in GitHub Desktop.
Empty Model object to avoid null reference issues
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 EmptyThingModel : BaseModel | |
| { | |
| private static readonly ThingModel _default = new EmptyThingModel(); | |
| static EmptyThingModel() { } | |
| private EmptyThingModel() { } | |
| public static ThingModel Default => _default; | |
| public new int Id => -1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment