Click here to Skip to main content
16,005,241 members
Home / Discussions / C#
   

C#

 
AnswerRe: A timer func problem??? Pin
partyganger2-Oct-04 16:21
partyganger2-Oct-04 16:21 
Questionadding to the byte[] ? Pin
SniperED0072-Oct-04 10:00
SniperED0072-Oct-04 10:00 
AnswerRe: adding to the byte[] ? Pin
Nnamdi Onyeyiri2-Oct-04 23:58
Nnamdi Onyeyiri2-Oct-04 23:58 
GeneralColor of Column Headers in a DataGrid Pin
MarkMokris2-Oct-04 7:44
MarkMokris2-Oct-04 7:44 
GeneralRe: Color of Column Headers in a DataGrid Pin
sreejith ss nair3-Oct-04 19:50
sreejith ss nair3-Oct-04 19:50 
GeneralBest way to store and access Global variables Pin
Zapss2-Oct-04 3:02
Zapss2-Oct-04 3:02 
GeneralRe: Best way to store and access Global variables Pin
Colin Angus Mackay2-Oct-04 4:00
Colin Angus Mackay2-Oct-04 4:00 
GeneralRe: Best way to store and access Global variables Pin
Andres Coder3-Oct-04 6:14
Andres Coder3-Oct-04 6:14 
First check out the tutorials at http://www.csharp-station.com/

I don't fully understand you question but it seems to me that you are trying to declare a public variable in a namespace ? Like that ?

namespace Something
{
public int myvariable = 0;
}

That's not possible. All members in C# must be inside objects (classes, structs). So what you must do is:

namespace Something
{
public class MyClass
{
public static int myvariable = 0;
}
}

The static modifier ensures you can access the variable without creating a new instance of the class.

P.S. You should however avoid using this tehnique as global variables are rarely needed and they're rally not usefull usually.
GeneralDesign Optimization Pin
sreejith ss nair2-Oct-04 2:56
sreejith ss nair2-Oct-04 2:56 
GeneralRe: Design Optimization Pin
Colin Angus Mackay2-Oct-04 4:11
Colin Angus Mackay2-Oct-04 4:11 
GeneralRe: Design Optimization Pin
sreejith ss nair2-Oct-04 18:43
sreejith ss nair2-Oct-04 18:43 
GeneralRe: Design Optimization Pin
Nnamdi Onyeyiri2-Oct-04 12:14
Nnamdi Onyeyiri2-Oct-04 12:14 
GeneralRe: Design Optimization Pin
sreejith ss nair2-Oct-04 18:43
sreejith ss nair2-Oct-04 18:43 
GeneralRe: Design Optimization Pin
hatim_ali3-Oct-04 19:33
hatim_ali3-Oct-04 19:33 
GeneralRe: Design Optimization Pin
sreejith ss nair3-Oct-04 19:48
sreejith ss nair3-Oct-04 19:48 
GeneralRe: Design Optimization Pin
Dave Kreskowiak4-Oct-04 7:07
mveDave Kreskowiak4-Oct-04 7:07 
Generalimage.saveadd function Pin
hudhud2-Oct-04 2:52
hudhud2-Oct-04 2:52 
GeneralRename XmlNode in Dom Pin
Anonymous2-Oct-04 1:52
Anonymous2-Oct-04 1:52 
GeneralRe: Rename XmlNode in Dom Pin
partyganger2-Oct-04 16:34
partyganger2-Oct-04 16:34 
AnswerRe: Rename XmlNode in Dom Pin
CMercs25-Aug-10 4:26
CMercs25-Aug-10 4:26 
GeneralSingleton Pin
hatim_ali2-Oct-04 0:46
hatim_ali2-Oct-04 0:46 
GeneralRe: Singleton Pin
Brian Nottingham2-Oct-04 18:06
Brian Nottingham2-Oct-04 18:06 
Generalusing system.xml Pin
Mridang Agarwalla2-Oct-04 0:16
Mridang Agarwalla2-Oct-04 0:16 
GeneralRe: using system.xml Pin
hatim_ali2-Oct-04 0:33
hatim_ali2-Oct-04 0:33 
GeneralRe: using system.xml Pin
Kevin McFarlane2-Oct-04 11:50
Kevin McFarlane2-Oct-04 11:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.