4
Reply

Is Empty structure allowed in C#?

Priti Kumari

Priti Kumari

10y
4.4k
1
Reply

    yes it may be public struct sts {} static void Main(string[] args) {sts stm;}

    No, Its not allowed. A struct can't be null in the same way that an int can't be null, and a float can't be null - they're all value types (and really, a developer should care if they're on the stack rather than on the heap). Nullable types make dealing with SQL a lot easier...

    No

    yes it may be public struct sts{} static void Main(string[] args){sts stm;}