I’m new in C#. In c# I can’t set value of a structure to null how can I create a structure with null value support?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Structs and value types can be made nullable by using the Generic Nullable<> class to wrap it. For instance:
C# provides a language feature for this by adding a question mark after the type:
Same should work for any value type including structs.
MSDN Explanation: Nullable Types (c#)