Interviews4 answers
Is Empty structure allowed in C#?
4 Answers
No
Mukesh KumarPosted Sep 5, 2017, 12:08 AM EDT
yes it may be
public struct sts
{
}
static void Main(string[] args)
{
sts stm;
}
Rahul PrajapatPosted Jun 1, 2015, 6:08 PM EDT
yes it may be
public struct sts
{
}
static void Main(string[] args)
{
sts stm;
}
Pankaj Kumar ChoudharyPosted May 25, 2015, 8:52 AM EDT
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 ParekhPosted Dec 29, 2013, 8:56 PM EST



