Query
How can i declare a global variable in c#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nanhe SiddiquePosted May 8, 2015, 3:27 AM
If you want a variable to be visible application wide you can use a static variable.
For example:
Then anywhere in your application you want to access SomeVariable you just do:
globalVariable.v
If a value is in a namespace then it wouldn't be visible to others. You have to use:
namespaceName.ClassName.VariableName
or
using namespaceName;
ClassName.VariableName
Deena elizPosted May 8, 2015, 3:27 AM
http://www.dotnetperls.com/global-variable
http://stackoverflow.com/questions/14368129/c-sharp-global-variables
refer these links.. its may help u..
thank you..