Unable to understand “A field initializer cannot reference the nonstatic field” Error?

Isn't it because the order of initilization when used as a field is not defined, ie selectedItems could be initialized before selectedItem, which would result in an error (or at least in unexpected behaviour, that selectedItems was null). In the second example the order is specific so everything is hunky dory.

It isn't the static field that's the problem. It's the attempt to use the non-static field selectedItem in the initialization of another non-static field selectedItems. This is a restriction in C#.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions