BeguiledFoil

The example space wars game does this, could anyone explain to me (or point me towards a resouce that explains) how this works Do classes that use static property fields for nonstatic member variables only work when there's one instance

Thanks, sorry if this is a stupid question...



Re: XNA Game Studio Express Static properties for nonstatic member variables?

Joel Martinez

the way static properties work in .net is that they belong to the one global/static instance of that type. if you don't specify that the class is a "static class", then you can also create instances of that class ... all of which can access that static property. If one of those instances changes the static property, they all see the same changed value.





Re: XNA Game Studio Express Static properties for nonstatic member variables?

BeguiledFoil

Ah, that makes sense. So in a sense those fields become shared, right



Re: XNA Game Studio Express Static properties for nonstatic member variables?

Joel Martinez

yes :-) and you'll even find that the "static" keyword is "Shared" in vb.net :-D