I understand why structs can't contain circular references which lead to logical memory problems, but why doesn't a nullable reference circumvent this limitation? For example:
struct Foo
{
Foo? bar;
}
Obviously this could very easily lead to stack overflows and circular references, if one wasn't careful, but shouldn't bar
be a pointer to another Foo
instance, and default to null
? Or (more likely) do I not understand how nullable value types are laid out in memory?
(My background knowledge consists mainly of information from this question and answers.)