I am having a problem in my code. I guess this is pretty straight forward, but I lack experience in OOP and C# so I have to ask you.
My code looks like this:
namespace RR
{
static class Program
{
[STAThread]
private static string token;
static void Main()
{
[...]
}
}
}
The problem is that the variable token
is not working/won't compile. I guess the error is pretty easy to spot, but I've tried any versions of static
, public static
and using functions (setters and getters) to do the work, but nothing works. I found this: Global variable in a static method , but then I had to remove [STAThread]
which I have no clue what even does, so I'd rather cross this problem another way.
The source is auto-setup when I created a new project in C# 2012.
To clearify: How can I use public variables in a static class like this without having to remove STAThread?