You gather I'm new to C#...
I'm used to declaring global variables and application constants in a common
script file in ASP apps but now in I'm sure things are done differently.
The sort of thing I'm talking about is easy to remember names for numerics
values that have a particular significance in the application
e.g.
When I was using JScript.
var PROD_BISCUIT = 1;
VAR PROD_CAKE = 2;
var PROD_SANDWICH = 3;
etc.
or
var DIR_INBOUND = 1;
var DIR_OUTBOUND = 2;
So now in C# if I was writing an SQL query string anywhere in the app I
could use:
string sql = "SELECT * FROM Luncbox AS L WHERE L.Direction=" + DIR_INBOUND +
" AND L.SnackTypeID = " + PROD_BISCUIT
I can think of a few places where I could do something similar in C# but
what is the best way?
I'd like to be able to use something visually brief and simple (not
Application["PROD_BISCUIT "] for instance).
What do you experience guys do, and why?
Also, is there a commonly used formatting convention for these things?
I've seen things like all caps or starting with an underscore, like I've
generally seen public and private variables differentiated with inital letter
case like:
public string MyString; (or a get())
private string myString;
--
Thanks
Grant Ord