c# - How to create structure with null value support? -


i'm new in c#. in c# can't set value of structure null how can create structure null value support?

structs , value types can made nullable using generic nullable<> class wrap it. instance:

nullable<int> num1 = null; 

c# provides language feature adding question mark after type:

int? num1 = null; 

same should work value type including structs.

msdn explanation: nullable types (c#)


Comments