ThePatrickP

Say i have a static class DX9, that holds the DirectX Device as a public variable, how would i name it Should i name it the same as the class

Another example: I have a static class Player, that holds an instance of the Character class as a public varaiable. How do I name it


Re: Visual C# General How to name single class instances

rauhanlinnake

Well its really up to you. If the class name is descriptive enough, you sure can use the class name as the variable name. If i remember, DirectX has multiple classes named as "Device", so you could name them as GraphicsDevice, Keyboard ect...

But i would suggest you not to use public variables, if it is not really necessary (performance issues). Properties makes it more easy to alter the code later if needed.




Re: Visual C# General How to name single class instances

ThePatrickP

Even if I would use properties, (I probably will) the same issue goes for how to name the property. Any suggestion (Mainly for my second example or in general)




Re: Visual C# General How to name single class instances

frederikm

Hi

there's no real guidelines for naming...

I tend to use the most obvious name possible..

for instance, you could name your Character variable Character, so you could access your property

Player.Character..

just use a name that conveys it's meaning as clearly as possible

Hope this helps you out, please close the thread if it does






Re: Visual C# General How to name single class instances

ThePatrickP

thx both.