I have a data type called
public enum Gender { Male, Female }
But some case i need to pass the vale for the gender as empty. So how can i create nullable Gender in C#
Either
Gender? myGender = null;
Or
Nullable<Gender> myGender = null;
The first variant is exactly the same as the second, but it just C# syntactic sugar to ease the readability of nullable variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With