I have created the following program:
namespace MyNamespace
{
public enum MyEnum { Jan = 1, Feb = 2, Mar = 3, Apr = 4, May = 5, Jun = 6, Jul = 7, Aug = 8, Sep = 9, Okt = 10, Nov = 11, Dec = 12 }
class Program
{
static void Main(string[] args)
{
private static string sourcePath = @"T:\his\is\my\source";
private static string destinationPath = @"T:\his\is\my\destination";
}
}
}
That's all I have so far. The problem is that it doesn't compile like this. I get the following exception:
} expected
It only works when I leave the Main
method body empty. When I use Ctrl + KD to format the code, it is formatted like this:
namespace MyNamespace
{
public enum MyEnum { SomeField = 1, SomeOtherField = 2, ... }
class Program
{
static void Main(string[] args)
{
private static string sourcePath = @"T:\his\is\my\source";
private static string destinationPath = @"T:\his\is\my\destination";
}
}
}
This totally doesn't make any sense. I can't even access the parameter args
:
The name 'args' does not exist in the current context
I really don't know why my project is behaving like this. Did anyone else encounter the same problem? What should I do?