4
Reply

Is Empty structure allowed in C#?

Priti Kumari

Priti Kumari

Dec 24, 2013
4.4k
1

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

    Rahul Prajapat
    June 01, 2015
    1

    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...

    Monika Parekh
    December 30, 2013
    1

    No

    Mukesh Kumar
    September 05, 2017
    0

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